diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor index aac0d088..e72d4595 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor @@ -20,5 +20,5 @@ // limitations under the License. -------------------------------------------------------------------------------> - + diff --git a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs index 6a4a5aa6..66b8d4c5 100644 --- a/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs +++ b/COMET.Web.Common/Components/Applications/DynamicApplicationBase.razor.cs @@ -59,6 +59,12 @@ public partial class DynamicApplicationBase [Parameter] public Thing CurrentThing { get; set; } + /// + /// Gets or sets the component's id + /// + [Parameter] + public object Id { get; set; } + /// /// Gets the of parameters that have to be passed to the /// diff --git a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs index 8c649f7a..e01a4656 100644 --- a/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs +++ b/COMETwebapp.Tests/Pages/ParameterEditor/ParameterEditorTestFixture.cs @@ -73,7 +73,7 @@ public class ParameterEditorTestFixture private Mock session; private Iteration firstIteration; private Iteration secondIteration; - private ICDPMessageBus messageBus; + private CDPMessageBus messageBus; [SetUp] public void Setup() @@ -123,21 +123,31 @@ public void Setup() mockConfigurationService.Setup(x => x.ServerConfiguration).Returns(new ServerConfiguration()); this.messageBus = new CDPMessageBus(); + var parameterTableViewModel = new Mock(); + parameterTableViewModel.Setup(x => x.Rows).Returns(new SourceList()); + + var parameterEditorBodyViewModel = new Mock(); + parameterEditorBodyViewModel.Setup(x => x.OptionSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.BatchParameterEditorViewModel).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ParameterTypeSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ElementSelector).Returns(new Mock().Object); + parameterEditorBodyViewModel.Setup(x => x.ParameterTableViewModel).Returns(parameterTableViewModel.Object); + + var configurationService = new Mock(); + configurationService.Setup(x => x.GetText(It.IsAny())).Returns("something"); + this.context.ConfigureDevExpressBlazor(); this.context.Services.AddSingleton(this.viewModel); this.context.Services.AddSingleton(this.sessionService.Object); + this.context.Services.AddSingleton(mockConfigurationService.Object); + this.context.Services.AddSingleton(parameterEditorBodyViewModel.Object); + this.context.Services.AddSingleton(parameterTableViewModel.Object); + this.context.Services.AddSingleton(configurationService.Object); + this.context.Services.AddSingleton(this.messageBus); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(); this.context.Services.AddSingleton(); - this.context.Services.AddSingleton(mockConfigurationService.Object); - this.context.Services.AddSingleton(this.messageBus); - - var configurationService = new Mock(); - configurationService.Setup(x => x.GetText(It.IsAny())).Returns("something"); - this.context.Services.AddSingleton(configurationService.Object); } [TearDown] diff --git a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs index 6d0e1aba..6cca26c6 100644 --- a/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs +++ b/COMETwebapp.Tests/ViewModels/Components/ParameterEditor/ParameterEditorBodyViewModelTestFixture.cs @@ -242,33 +242,13 @@ public async Task VerifyApplyFilters() await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); this.viewModel.ElementSelector.SelectedElementBase = this.viewModel.ElementSelector.AvailableElements.First(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, this.viewModel.ElementSelector.SelectedElementBase, null, true), Times.Once); - - this.viewModel.ElementSelector.SelectedElementBase = null; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.viewModel.ParameterTypeSelector.SelectedParameterType = this.viewModel.ParameterTypeSelector.AvailableParameterTypes.First(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.DefaultOption, - null, this.viewModel.ParameterTypeSelector.SelectedParameterType, true), Times.Once); - - this.viewModel.ParameterTypeSelector.SelectedParameterType = null; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.viewModel.OptionSelector.SelectedOption = this.viewModel.CurrentThing.Option.Last(); - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.Option.Last(), - null, null, true), Times.Once); - this.viewModel.IsOwnedParameters = false; - await TaskHelper.WaitWhileAsync(() => this.viewModel.IsLoading); - this.tableViewModel.Verify(x => x.ApplyFilters(this.iteration.Option.Last(), - null, null, false), Times.Once); + this.viewModel.ApplyFilters(); + + this.tableViewModel.Verify(x => x.ApplyFilters(It.IsAny