Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander van Delft committed Dec 6, 2024
1 parent 2535dfc commit 64e344e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace COMET.Web.Common.Tests.Components.Applications
using COMET.Web.Common.Components.Applications;
using COMET.Web.Common.Components.Selectors;
using COMET.Web.Common.Model.Configuration;
using COMET.Web.Common.Services.Cache;
using COMET.Web.Common.Services.ConfigurationService;
using COMET.Web.Common.Services.SessionManagement;
using COMET.Web.Common.Services.StringTableService;
Expand Down Expand Up @@ -70,6 +71,7 @@ public void Setup()
this.viewModel = new Mock<ISingleEngineeringModelApplicationTemplateViewModel>();

this.openEngineeringModels = [];
var cacheService = new Mock<ICacheService>();
var sessionService = new Mock<ISessionService>();
sessionService.Setup(x => x.OpenEngineeringModels).Returns(this.openEngineeringModels);
sessionService.Setup(x => x.OpenIterations).Returns(new SourceList<Iteration>());
Expand All @@ -84,6 +86,7 @@ public void Setup()
this.context.Services.AddSingleton(mockConfigurationService.Object);
this.context.Services.AddSingleton(new Mock<IStringTableService>().Object);
this.context.Services.AddSingleton(sessionService.Object);
this.context.Services.AddSingleton(cacheService.Object);
this.context.ConfigureDevExpressBlazor();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace COMETwebapp.Tests.Pages.ModelDashboard
using COMET.Web.Common.Components.Selectors;
using COMET.Web.Common.Extensions;
using COMET.Web.Common.Model.Configuration;
using COMET.Web.Common.Services.Cache;
using COMET.Web.Common.Services.ConfigurationService;
using COMET.Web.Common.Services.SessionManagement;
using COMET.Web.Common.Services.StringTableService;
Expand Down Expand Up @@ -66,6 +67,7 @@ public class ModelDashboardTestFixture
private TestContext context;
private ISingleIterationApplicationTemplateViewModel viewModel;
private Mock<ISessionService> sessionService;
private Mock<ICacheService> cacheService;
private SourceList<Iteration> openedIterations;
private Mock<ISession> session;
private Iteration firstIteration;
Expand All @@ -77,6 +79,7 @@ public void Setup()
{
this.context = new TestContext();
this.sessionService = new Mock<ISessionService>();
this.cacheService = new Mock<ICacheService>();
this.openedIterations = new SourceList<Iteration>();
this.sessionService.Setup(x => x.OpenIterations).Returns(this.openedIterations);
this.viewModel = new SingleIterationApplicationTemplateViewModel(this.sessionService.Object, new IterationSelectorViewModel());
Expand Down Expand Up @@ -121,6 +124,7 @@ public void Setup()
this.context.ConfigureDevExpressBlazor();
this.context.Services.AddSingleton(this.viewModel);
this.context.Services.AddSingleton(this.sessionService.Object);
this.context.Services.AddSingleton(this.cacheService.Object);
this.context.Services.AddSingleton(mockConfigurationService.Object);
this.context.Services.AddSingleton<IOpenModelViewModel, OpenModelViewModel>();
this.context.Services.AddSingleton<IModelDashboardBodyViewModel, ModelDashboardBodyViewModel>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace COMETwebapp.Tests.Pages.ParameterEditor
using COMET.Web.Common.Components.Selectors;
using COMET.Web.Common.Extensions;
using COMET.Web.Common.Model.Configuration;
using COMET.Web.Common.Services.Cache;
using COMET.Web.Common.Services.ConfigurationService;
using COMET.Web.Common.Services.NotificationService;
using COMET.Web.Common.Services.SessionManagement;
Expand Down Expand Up @@ -69,6 +70,7 @@ public class ParameterEditorTestFixture
private TestContext context;
private ISingleIterationApplicationTemplateViewModel viewModel;
private Mock<ISessionService> sessionService;
private Mock<ICacheService> cacheService;
private SourceList<Iteration> openedIterations;
private Mock<ISession> session;
private Iteration firstIteration;
Expand All @@ -80,6 +82,7 @@ public void Setup()
{
this.context = new TestContext();
this.sessionService = new Mock<ISessionService>();
this.cacheService = new Mock<ICacheService>();
this.openedIterations = new SourceList<Iteration>();
this.sessionService.Setup(x => x.OpenIterations).Returns(this.openedIterations);
this.viewModel = new SingleIterationApplicationTemplateViewModel(this.sessionService.Object, new IterationSelectorViewModel());
Expand Down Expand Up @@ -139,6 +142,7 @@ public void Setup()
this.context.ConfigureDevExpressBlazor();
this.context.Services.AddSingleton(this.viewModel);
this.context.Services.AddSingleton(this.sessionService.Object);
this.context.Services.AddSingleton(this.cacheService.Object);
this.context.Services.AddSingleton(mockConfigurationService.Object);
this.context.Services.AddSingleton(parameterEditorBodyViewModel.Object);
this.context.Services.AddSingleton(parameterTableViewModel.Object);
Expand Down
4 changes: 4 additions & 0 deletions COMETwebapp.Tests/Pages/Viewer/ViewerTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace COMETwebapp.Tests.Pages.Viewer
using COMET.Web.Common.Components.Selectors;
using COMET.Web.Common.Extensions;
using COMET.Web.Common.Model.Configuration;
using COMET.Web.Common.Services.Cache;
using COMET.Web.Common.Services.ConfigurationService;
using COMET.Web.Common.Services.SessionManagement;
using COMET.Web.Common.Services.StringTableService;
Expand Down Expand Up @@ -70,6 +71,7 @@ public class ViewerTestFixture
private ISingleIterationApplicationTemplateViewModel viewModel;
private Mock<ISessionService> sessionService;
private SourceList<Iteration> openedIterations;
private Mock<ICacheService> cacheService;
private Mock<ISession> session;
private Iteration firstIteration;
private Iteration secondIteration;
Expand All @@ -80,6 +82,7 @@ public void Setup()
{
this.context = new TestContext();
this.sessionService = new Mock<ISessionService>();
this.cacheService = new Mock<ICacheService>();
this.openedIterations = new SourceList<Iteration>();
this.sessionService.Setup(x => x.OpenIterations).Returns(this.openedIterations);
this.viewModel = new SingleIterationApplicationTemplateViewModel(this.sessionService.Object, new IterationSelectorViewModel());
Expand Down Expand Up @@ -125,6 +128,7 @@ public void Setup()
this.context.ConfigureDevExpressBlazor();
this.context.Services.AddSingleton(this.viewModel);
this.context.Services.AddSingleton(this.sessionService.Object);
this.context.Services.AddSingleton(this.cacheService.Object);
this.context.Services.AddSingleton<IOpenModelViewModel, OpenModelViewModel>();
this.context.Services.AddSingleton<IViewerBodyViewModel, ViewerBodyViewModel>();
this.context.Services.AddSingleton<ISubscriptionService, SubscriptionService>();
Expand Down

0 comments on commit 64e344e

Please sign in to comment.