Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj =================================================================== diff -u -rc045873bae1b4daaf2325e9903dcf656702c24c1 -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision c045873bae1b4daaf2325e9903dcf656702c24c1) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Ringtoets.GrassCoverErosionOutwards.Forms.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.csproj) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -53,7 +53,7 @@ - + UserControl Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightCalculationsView.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightCalculationsView.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightCalculationsView.cs (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -0,0 +1,134 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Core.Common.Base; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Service; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; +using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Views +{ + /// + /// View for presenting and performing wave height calculations for the . + /// + public class GrassCoverErosionOutwardsWaveHeightCalculationsView : HydraulicBoundaryCalculationsView + { + private readonly GrassCoverErosionOutwardsWaveHeightCalculationMessageProvider messageProvider; + private readonly Observer failureMechanismObserver; + private readonly Func getNormFunc; + + /// + /// Creates a new instance of . + /// + /// The calculations to show in the view. + /// The failure mechanism that the calculations belong to. + /// The assessment section that the calculations belong to. + /// for getting the norm to derive a mechanism specific norm from. + /// Thrown when any input parameter is null. + public GrassCoverErosionOutwardsWaveHeightCalculationsView(ObservableList calculations, + GrassCoverErosionOutwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + Func getNormFunc) + : base(calculations, assessmentSection) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (getNormFunc == null) + { + throw new ArgumentNullException(nameof(getNormFunc)); + } + + FailureMechanism = failureMechanism; + messageProvider = new GrassCoverErosionOutwardsWaveHeightCalculationMessageProvider(); + + failureMechanismObserver = new Observer(UpdateCalculateForSelectedButton) + { + Observable = failureMechanism + }; + + this.getNormFunc = getNormFunc; + } + + public override object Data { get; set; } + + /// + /// Gets the for which the + /// hydraulic boundary location calculations are shown. + /// + public GrassCoverErosionOutwardsFailureMechanism FailureMechanism { get; } + + protected override void Dispose(bool disposing) + { + failureMechanismObserver.Dispose(); + + base.Dispose(disposing); + } + + protected override void InitializeDataGridView() + { + base.InitializeDataGridView(); + dataGridViewControl.AddTextBoxColumn(nameof(HydraulicBoundaryLocationRow.Result), + Resources.GrassCoverErosionOutwardsHydraulicBoundaryLocation_WaveHeight_DisplayName); + } + + protected override object CreateSelectedItemFromCurrentRow() + { + DataGridViewRow currentRow = dataGridViewControl.CurrentRow; + + return currentRow != null + ? new GrassCoverErosionOutwardsWaveHeightCalculationContext(((HydraulicBoundaryLocationRow) currentRow.DataBoundItem).CalculatableObject) + : null; + } + + protected override void PerformSelectedCalculations(IEnumerable calculations) + { + double mechanismSpecificNorm = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability( + getNormFunc(), + FailureMechanism.Contribution, + FailureMechanism.GeneralInput.N); + + CalculationGuiService.CalculateWaveHeights(AssessmentSection.HydraulicBoundaryDatabase.FilePath, + AssessmentSection.HydraulicBoundaryDatabase.EffectivePreprocessorDirectory(), + calculations, + mechanismSpecificNorm, + messageProvider); + } + + protected override string ValidateCalculatableObjects() + { + return FailureMechanism != null && FailureMechanism.Contribution <= 0 + ? RingtoetsCommonFormsResources.Contribution_of_failure_mechanism_zero + : base.ValidateCalculatableObjects(); + } + } +} \ No newline at end of file Fisheye: Tag 036dbc232fd0151d7612ea584b3b46f419b74eae refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -rc045873bae1b4daaf2325e9903dcf656702c24c1 -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision c045873bae1b4daaf2325e9903dcf656702c24c1) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -178,17 +178,17 @@ yield return new ViewInfo< GrassCoverErosionOutwardsWaveHeightLocationsContext, IEnumerable, - GrassCoverErosionOutwardsWaveHeightLocationsView> + GrassCoverErosionOutwardsWaveHeightCalculationsView> { GetViewName = (view, context) => RingtoetsGrassCoverErosionOutwardsFormsResources.GrassCoverErosionOutwardsWaveHeightLocationsContext_DisplayName, GetViewData = context => context.WrappedData, CloseForData = CloseGrassCoverErosionOutwardsLocationsViewForData, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, - CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationsView(GetHydraulicBoundaryLocationCalculations(context.FailureMechanism.HydraulicBoundaryLocations, - hbl => hbl.WaveHeightCalculation1), - context.FailureMechanism, - context.AssessmentSection, - () => context.AssessmentSection.FailureMechanismContribution.Norm), + CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightCalculationsView(GetHydraulicBoundaryLocationCalculations(context.FailureMechanism.HydraulicBoundaryLocations, + hbl => hbl.WaveHeightCalculation1), + context.FailureMechanism, + context.AssessmentSection, + () => context.AssessmentSection.FailureMechanismContribution.Norm), AfterCreate = (view, context) => { view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; } }; } @@ -403,9 +403,9 @@ #endregion - #region GrassCoverErosionOutwardsWaveHeightLocationsView + #region GrassCoverErosionOutwardsWaveHeightCalculationsView - private static bool CloseGrassCoverErosionOutwardsLocationsViewForData(GrassCoverErosionOutwardsWaveHeightLocationsView view, object dataToCloseFor) + private static bool CloseGrassCoverErosionOutwardsLocationsViewForData(GrassCoverErosionOutwardsWaveHeightCalculationsView view, object dataToCloseFor) { return CloseHydraulicBoundaryLocationsViewForData(view.AssessmentSection, dataToCloseFor); } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj =================================================================== diff -u -rc045873bae1b4daaf2325e9903dcf656702c24c1 -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision c045873bae1b4daaf2325e9903dcf656702c24c1) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Forms.Test.csproj) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -49,7 +49,7 @@ - + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightCalculationsViewTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightCalculationsViewTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightCalculationsViewTest.cs (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -0,0 +1,734 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Base.Geometry; +using Core.Common.Controls.DataGrid; +using Core.Common.TestUtil; +using Core.Common.Util.Reflection; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.GuiServices; +using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Service; +using Ringtoets.Common.Service.MessageProviders; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Forms.Views; +using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders; + +namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.Views +{ + [TestFixture] + public class GrassCoverErosionOutwardsWaveHeightCalculationsViewTest + { + private const int calculateColumnIndex = 0; + private const int includeIllustrationPointsColumnIndex = 1; + private const int locationNameColumnIndex = 2; + private const int locationIdColumnIndex = 3; + private const int locationColumnIndex = 4; + private const int waveHeightColumnIndex = 5; + + private Form testForm; + private MockRepository mockRepository; + + [SetUp] + public void Setup() + { + testForm = new Form(); + mockRepository = new MockRepository(); + } + + [TearDown] + public void TearDown() + { + testForm.Dispose(); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + () => 0.01)) + { + // Assert + Assert.IsInstanceOf(view); + Assert.IsNull(view.Data); + } + } + + [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + null, + assessmentSection, + () => 0.01); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + } + + [Test] + public void Constructor_GetNormFuncNull_ThrowsArgumentNullException() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getNormFunc", exception.ParamName); + } + + [Test] + public void Constructor_DataGridViewCorrectlyInitialized() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + ShowWaveHeightLocationsView(new ObservableList(), assessmentSection, 0.01, testForm); + + // Assert + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + Assert.AreEqual(6, calculationsDataGridView.ColumnCount); + + var calculateColumn = (DataGridViewCheckBoxColumn) calculationsDataGridView.Columns[calculateColumnIndex]; + Assert.AreEqual("Berekenen", calculateColumn.HeaderText); + + var includeIllustrationPointsColumn = (DataGridViewCheckBoxColumn) calculationsDataGridView.Columns[includeIllustrationPointsColumnIndex]; + Assert.AreEqual("Illustratiepunten inlezen", includeIllustrationPointsColumn.HeaderText); + + var locationNameColumn = (DataGridViewTextBoxColumn) calculationsDataGridView.Columns[locationNameColumnIndex]; + Assert.AreEqual("Naam", locationNameColumn.HeaderText); + + var locationIdColumn = (DataGridViewTextBoxColumn) calculationsDataGridView.Columns[locationIdColumnIndex]; + Assert.AreEqual("ID", locationIdColumn.HeaderText); + + var locationColumn = (DataGridViewTextBoxColumn) calculationsDataGridView.Columns[locationColumnIndex]; + Assert.AreEqual("Coördinaten [m]", locationColumn.HeaderText); + + var waveHeightColumn = (DataGridViewTextBoxColumn) calculationsDataGridView.Columns[waveHeightColumnIndex]; + Assert.AreEqual("Golfhoogte bij doorsnede-eis [m]", waveHeightColumn.HeaderText); + + var button = (Button) testForm.Controls.Find("CalculateForSelectedButton", true).First(); + Assert.IsFalse(button.Enabled); + } + + [Test] + public void WaveHeightLocationsView_AssessmentSectionWithData_DataGridViewCorrectlyInitialized() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + ShowFullyConfiguredWaveHeightLocationsView(assessmentSection, testForm); + + // Assert + DataGridViewControl calculationsDataGridViewControl = GetCalculationsDataGridViewControl(); + DataGridViewRowCollection rows = calculationsDataGridViewControl.Rows; + Assert.AreEqual(4, rows.Count); + + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(6, cells.Count); + Assert.AreEqual(false, cells[calculateColumnIndex].FormattedValue); + Assert.AreEqual(false, cells[includeIllustrationPointsColumnIndex].FormattedValue); + Assert.AreEqual("1", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("1", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(1, 1).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual("-", cells[waveHeightColumnIndex].FormattedValue); + + cells = rows[1].Cells; + Assert.AreEqual(6, cells.Count); + Assert.AreEqual(false, cells[calculateColumnIndex].FormattedValue); + Assert.AreEqual(false, cells[includeIllustrationPointsColumnIndex].FormattedValue); + Assert.AreEqual("2", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("2", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(2, 2).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual(1.23.ToString(CultureInfo.CurrentCulture), cells[waveHeightColumnIndex].FormattedValue); + + cells = rows[2].Cells; + Assert.AreEqual(6, cells.Count); + Assert.AreEqual(false, cells[calculateColumnIndex].FormattedValue); + Assert.AreEqual(true, cells[includeIllustrationPointsColumnIndex].FormattedValue); + Assert.AreEqual("3", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("3", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(3, 3).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual("-", cells[waveHeightColumnIndex].FormattedValue); + + cells = rows[3].Cells; + Assert.AreEqual(6, cells.Count); + Assert.AreEqual(false, cells[calculateColumnIndex].FormattedValue); + Assert.AreEqual(true, cells[includeIllustrationPointsColumnIndex].FormattedValue); + Assert.AreEqual("4", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("4", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(4, 4).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual(1.01.ToString(CultureInfo.CurrentCulture), cells[waveHeightColumnIndex].FormattedValue); + } + + [Test] + public void WaveHeightLocationsView_HydraulicBoundaryLocationsUpdated_DataGridViewCorrectlyUpdated() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + ShowWaveHeightLocationsView(calculations, assessmentSection, 0.01, testForm); + + // Precondition + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + object dataGridViewSource = calculationsDataGridView.DataSource; + DataGridViewRowCollection rows = calculationsDataGridView.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + Assert.AreEqual(4, rows.Count); + + const double waveHeight = 1.1; + + calculations.Clear(); + calculations.Add(new HydraulicBoundaryLocationCalculation(new HydraulicBoundaryLocation(10, "10", 10, 10)) + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = new TestHydraulicBoundaryLocationOutput(waveHeight) + }); + + // Call + calculations.NotifyObservers(); + + // Assert + Assert.AreEqual(1, rows.Count); + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(6, cells.Count); + Assert.AreEqual(false, cells[calculateColumnIndex].FormattedValue); + Assert.AreEqual(true, cells[includeIllustrationPointsColumnIndex].FormattedValue); + Assert.AreEqual("10", cells[locationNameColumnIndex].FormattedValue); + Assert.AreEqual("10", cells[locationIdColumnIndex].FormattedValue); + Assert.AreEqual(new Point2D(10, 10).ToString(), cells[locationColumnIndex].FormattedValue); + Assert.AreEqual(waveHeight, cells[waveHeightColumnIndex].Value); + Assert.AreNotSame(dataGridViewSource, calculationsDataGridView.DataSource); + Assert.IsFalse((bool) rows[0].Cells[calculateColumnIndex].Value); + } + + [Test] + public void WaveHeightLocationsView_HydraulicBoundaryLocationUpdated_IllustrationPointsControlCorrectlyUpdated() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + ShowWaveHeightLocationsView(calculations, assessmentSection, 0.01, testForm); + IllustrationPointsControl illustrationPointsControl = GetIllustrationPointsControl(); + DataGridViewControl calculationsDataGridViewControl = GetCalculationsDataGridViewControl(); + + calculationsDataGridViewControl.SetCurrentCell(calculationsDataGridViewControl.GetCell(2, 0)); + + // Precondition + CollectionAssert.IsEmpty(illustrationPointsControl.Data); + + var topLevelIllustrationPoints = new[] + { + new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + "Regular", + new TestSubMechanismIllustrationPoint()) + }; + var generalResult = new TestGeneralResultSubMechanismIllustrationPoint(topLevelIllustrationPoints); + var output = new TestHydraulicBoundaryLocationOutput(generalResult); + + // Call + calculations[2].Output = output; + calculations[2].NotifyObservers(); + + // Assert + IEnumerable expectedControlItems = CreateControlItems(generalResult); + CollectionAssert.AreEqual(expectedControlItems, illustrationPointsControl.Data, new IllustrationPointControlItemComparer()); + } + + [Test] + public void CalculateForSelectedButton_OneSelected_CallsCalculateWaveHeightsSelectionNotChanged() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution) + .Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution()); + assessmentSection.Stub(a => a.Attach(null)).IgnoreArguments(); + assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); + + var guiService = mockRepository.StrictMock(); + + HydraulicBoundaryLocationCalculation[] performedCalculations = null; + guiService.Expect(ch => ch.CalculateWaveHeights(null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled( + invocation => { performedCalculations = ((IEnumerable) invocation.Arguments[2]).ToArray(); }); + + mockRepository.ReplayAll(); + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowWaveHeightLocationsView(calculations, assessmentSection, 0.01, testForm); + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + object dataGridViewSource = calculationsDataGridView.DataSource; + DataGridViewRowCollection rows = calculationsDataGridView.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + + view.CalculationGuiService = guiService; + var button = new ButtonTester("CalculateForSelectedButton", testForm); + + // Call + button.Click(); + + // Assert + Assert.AreEqual(1, performedCalculations.Length); + Assert.AreSame(calculations.First(), performedCalculations.First()); + Assert.AreSame(dataGridViewSource, calculationsDataGridView.DataSource); + Assert.IsTrue((bool) rows[0].Cells[calculateColumnIndex].Value); + Assert.IsFalse((bool) rows[1].Cells[calculateColumnIndex].Value); + Assert.IsFalse((bool) rows[2].Cells[calculateColumnIndex].Value); + } + + [Test] + public void CalculateForSelectedButton_OneSelectedButCalculationGuiServiceNotSet_DoesNotThrowException() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + ShowFullyConfiguredWaveHeightLocationsView(assessmentSection, testForm); + + DataGridViewControl calculationsDataGridViewControl = GetCalculationsDataGridViewControl(); + DataGridViewRowCollection rows = calculationsDataGridViewControl.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + + var button = new ButtonTester("CalculateForSelectedButton", testForm); + + // Call + TestDelegate test = () => button.Click(); + + // Assert + Assert.DoesNotThrow(test); + } + + [Test] + [TestCase(false, false, "De bijdrage van dit toetsspoor is nul.", TestName = "CalculateButton_RowSelectionContributionSet_SyncedAccordingly(false, false, message)")] + [TestCase(true, false, "De bijdrage van dit toetsspoor is nul.", TestName = "CalculateButton_RowSelectionContributionSet_SyncedAccordingly(true, false, message)")] + [TestCase(false, true, "Er zijn geen berekeningen geselecteerd.", TestName = "CalculateButton_RowSelectionContributionSet_SyncedAccordingly(false, true, message)")] + [TestCase(true, true, "", TestName = "CalculateButton_RowSelectionContributionSet_SyncedAccordingly(true, true, message)")] + public void GivenWaveHeightLocationsView_WhenSpecificCombinationOfRowSelectionAndFailureMechanismContributionSet_ThenButtonAndErrorMessageSyncedAccordingly(bool rowSelected, + bool contributionNotZero, + string expectedErrorMessage) + { + // Given + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowFullyConfiguredWaveHeightLocationsView(assessmentSection, testForm); + if (!contributionNotZero) + { + view.FailureMechanism.Contribution = 0; + view.FailureMechanism.NotifyObservers(); + } + + // When + if (rowSelected) + { + DataGridViewControl calculationsDataGridViewControl = GetCalculationsDataGridViewControl(); + DataGridViewRowCollection rows = calculationsDataGridViewControl.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + } + + // Then + var button = (Button) view.Controls.Find("CalculateForSelectedButton", true)[0]; + Assert.AreEqual(rowSelected && contributionNotZero, button.Enabled); + var errorProvider = TypeUtils.GetField(view, "CalculateForSelectedButtonErrorProvider"); + Assert.AreEqual(expectedErrorMessage, errorProvider.GetError(button)); + } + + [Test] + public void CalculateForSelectedButton_HydraulicBoundaryDatabaseWithCanUsePreprocessorFalse_CalculateWaveHeightsCalledAsExpected() + { + // Setup + const string databaseFilePath = "DatabaseFilePath"; + const double norm = 0.01; + + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution) + .Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution()); + assessmentSection.Stub(a => a.Attach(null)).IgnoreArguments(); + assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); + + var guiService = mockRepository.StrictMock(); + + var hydraulicBoundaryDatabaseFilePathValue = ""; + var preprocessorDirectoryValue = ""; + HydraulicBoundaryLocationCalculation[] performedCalculations = null; + double normValue = double.NaN; + ICalculationMessageProvider messageProviderValue = null; + guiService.Expect(ch => ch.CalculateWaveHeights(null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled( + invocation => + { + hydraulicBoundaryDatabaseFilePathValue = invocation.Arguments[0].ToString(); + preprocessorDirectoryValue = invocation.Arguments[1].ToString(); + performedCalculations = ((IEnumerable) invocation.Arguments[2]).ToArray(); + normValue = (double) invocation.Arguments[3]; + messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[4]; + }); + + mockRepository.ReplayAll(); + + assessmentSection.HydraulicBoundaryDatabase.FilePath = databaseFilePath; + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowWaveHeightLocationsView(calculations, assessmentSection, norm, testForm); + GrassCoverErosionOutwardsFailureMechanism failureMechanism = view.FailureMechanism; + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + DataGridViewRowCollection rows = calculationsDataGridView.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + + view.CalculationGuiService = guiService; + var button = new ButtonTester("CalculateForSelectedButton", testForm); + + // Call + button.Click(); + + // Assert + double expectedNorm = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability( + norm, + failureMechanism.Contribution, + failureMechanism.GeneralInput.N); + + Assert.IsInstanceOf(messageProviderValue); + Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue); + Assert.AreEqual("", preprocessorDirectoryValue); + Assert.AreEqual(expectedNorm, normValue); + Assert.AreEqual(1, performedCalculations.Length); + Assert.AreSame(calculations.First(), performedCalculations.First()); + } + + [Test] + public void CalculateForSelectedButton_HydraulicBoundaryDatabaseWithUsePreprocessorTrue_CalculateWaveHeightsCalledAsExpected() + { + // Setup + const string databaseFilePath = "DatabaseFilePath"; + string preprocessorDirectory = TestHelper.GetScratchPadPath(); + const double norm = 0.01; + + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution) + .Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution()); + assessmentSection.Stub(a => a.Attach(null)).IgnoreArguments(); + assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); + + var guiService = mockRepository.StrictMock(); + + var hydraulicBoundaryDatabaseFilePathValue = ""; + var preprocessorDirectoryValue = ""; + HydraulicBoundaryLocationCalculation[] performedCalculations = null; + double normValue = double.NaN; + ICalculationMessageProvider messageProviderValue = null; + guiService.Expect(ch => ch.CalculateWaveHeights(null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled( + invocation => + { + hydraulicBoundaryDatabaseFilePathValue = invocation.Arguments[0].ToString(); + preprocessorDirectoryValue = invocation.Arguments[1].ToString(); + performedCalculations = ((IEnumerable) invocation.Arguments[2]).ToArray(); + normValue = (double) invocation.Arguments[3]; + messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[4]; + }); + + mockRepository.ReplayAll(); + + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase; + hydraulicBoundaryDatabase.FilePath = databaseFilePath; + hydraulicBoundaryDatabase.CanUsePreprocessor = true; + hydraulicBoundaryDatabase.UsePreprocessor = true; + hydraulicBoundaryDatabase.PreprocessorDirectory = preprocessorDirectory; + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowWaveHeightLocationsView(calculations, assessmentSection, norm, testForm); + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + DataGridViewRowCollection rows = calculationsDataGridView.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + + view.CalculationGuiService = guiService; + GrassCoverErosionOutwardsFailureMechanism failureMechanism = view.FailureMechanism; + var button = new ButtonTester("CalculateForSelectedButton", testForm); + + // Call + button.Click(); + + // Assert + double expectedNorm = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability( + norm, + failureMechanism.Contribution, + failureMechanism.GeneralInput.N); + + Assert.IsInstanceOf(messageProviderValue); + Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue); + Assert.AreEqual(preprocessorDirectory, preprocessorDirectoryValue); + Assert.AreEqual(expectedNorm, normValue); + Assert.AreEqual(1, performedCalculations.Length); + Assert.AreSame(calculations.First(), performedCalculations.First()); + } + + [Test] + public void CalculateForSelectedButton_HydraulicBoundaryDatabaseWithUsePreprocessorFalse_CalculateWaveHeightsCalledAsExpected() + { + // Setup + const string databaseFilePath = "DatabaseFilePath"; + const double norm = 0.01; + + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + assessmentSection.Stub(a => a.Id).Return(string.Empty); + assessmentSection.Stub(a => a.FailureMechanismContribution) + .Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution()); + assessmentSection.Stub(a => a.Attach(null)).IgnoreArguments(); + assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); + + var guiService = mockRepository.StrictMock(); + + var hydraulicBoundaryDatabaseFilePathValue = ""; + var preprocessorDirectoryValue = ""; + HydraulicBoundaryLocationCalculation[] performedCalculations = null; + double normValue = double.NaN; + ICalculationMessageProvider messageProviderValue = null; + guiService.Expect(ch => ch.CalculateWaveHeights(null, null, null, int.MinValue, null)).IgnoreArguments().WhenCalled( + invocation => + { + hydraulicBoundaryDatabaseFilePathValue = invocation.Arguments[0].ToString(); + preprocessorDirectoryValue = invocation.Arguments[1].ToString(); + performedCalculations = ((IEnumerable) invocation.Arguments[2]).ToArray(); + normValue = (double) invocation.Arguments[3]; + messageProviderValue = (ICalculationMessageProvider) invocation.Arguments[4]; + }); + + mockRepository.ReplayAll(); + + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase; + hydraulicBoundaryDatabase.FilePath = databaseFilePath; + hydraulicBoundaryDatabase.CanUsePreprocessor = true; + hydraulicBoundaryDatabase.UsePreprocessor = false; + hydraulicBoundaryDatabase.PreprocessorDirectory = "InvalidPreprocessorDirectory"; + + ObservableList calculations = GetTestHydraulicBoundaryLocationCalculations(); + + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowWaveHeightLocationsView(calculations, assessmentSection, norm, testForm); + DataGridView calculationsDataGridView = GetCalculationsDataGridView(); + DataGridViewRowCollection rows = calculationsDataGridView.Rows; + rows[0].Cells[calculateColumnIndex].Value = true; + + view.CalculationGuiService = guiService; + GrassCoverErosionOutwardsFailureMechanism failureMechanism = view.FailureMechanism; + var button = new ButtonTester("CalculateForSelectedButton", testForm); + + // Call + button.Click(); + + // Assert + double expectedNorm = RingtoetsCommonDataCalculationService.ProfileSpecificRequiredProbability( + norm, + failureMechanism.Contribution, + failureMechanism.GeneralInput.N); + + Assert.IsInstanceOf(messageProviderValue); + Assert.AreEqual(databaseFilePath, hydraulicBoundaryDatabaseFilePathValue); + Assert.AreEqual("", preprocessorDirectoryValue); + Assert.AreEqual(expectedNorm, normValue); + Assert.AreEqual(1, performedCalculations.Length); + Assert.AreSame(calculations.First(), performedCalculations.First()); + } + + private DataGridView GetCalculationsDataGridView() + { + return ControlTestHelper.GetDataGridView(testForm, "DataGridView"); + } + + private DataGridViewControl GetCalculationsDataGridViewControl() + { + return ControlTestHelper.GetDataGridViewControl(testForm, "DataGridViewControl"); + } + + private IllustrationPointsControl GetIllustrationPointsControl() + { + return ControlTestHelper.GetControls(testForm, "IllustrationPointsControl").Single(); + } + + private static IEnumerable CreateControlItems( + GeneralResult generalResult) + { + return generalResult.TopLevelIllustrationPoints + .Select(topLevelIllustrationPoint => + { + SubMechanismIllustrationPoint illustrationPoint = topLevelIllustrationPoint.SubMechanismIllustrationPoint; + return new IllustrationPointControlItem(topLevelIllustrationPoint, + topLevelIllustrationPoint.WindDirection.Name, + topLevelIllustrationPoint.ClosingSituation, + illustrationPoint.Stochasts, + illustrationPoint.Beta); + }); + } + + private static GrassCoverErosionOutwardsWaveHeightCalculationsView ShowWaveHeightLocationsView(ObservableList calculations, + IAssessmentSection assessmentSection, + double norm, + Form form) + { + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { + Contribution = 10 + }; + + var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(calculations, + failureMechanism, + assessmentSection, + () => norm); + + form.Controls.Add(view); + form.Show(); + + return view; + } + + private static GrassCoverErosionOutwardsWaveHeightCalculationsView ShowFullyConfiguredWaveHeightLocationsView(IAssessmentSection assessmentSection, + Form form) + { + return ShowWaveHeightLocationsView(GetTestHydraulicBoundaryLocationCalculations(), assessmentSection, 0.01, form); + } + + private static ObservableList GetTestHydraulicBoundaryLocationCalculations() + { + var topLevelIllustrationPoints = new[] + { + new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + "Regular", + new TestSubMechanismIllustrationPoint()), + new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + "Test", + new TestSubMechanismIllustrationPoint()) + }; + + var generalResult = new TestGeneralResultSubMechanismIllustrationPoint(topLevelIllustrationPoints); + + return new ObservableList + { + new HydraulicBoundaryLocationCalculation(new HydraulicBoundaryLocation(1, "1", 1.0, 1.0)), + new HydraulicBoundaryLocationCalculation(new HydraulicBoundaryLocation(2, "2", 2.0, 2.0)) + { + Output = new TestHydraulicBoundaryLocationOutput(1.23) + }, + new HydraulicBoundaryLocationCalculation(new HydraulicBoundaryLocation(3, "3", 3.0, 3.0)) + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + } + }, + new HydraulicBoundaryLocationCalculation(new HydraulicBoundaryLocation(4, "4", 4.0, 4.0)) + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = new TestHydraulicBoundaryLocationOutput(1.01, generalResult) + } + }; + } + + [TestFixture] + private class ViewSynchronizationTest : LocationsViewSynchronizationTester + { + private ObservableList calculations; + + protected override int OutputColumnIndex + { + get + { + return waveHeightColumnIndex; + } + } + + public override void Setup() + { + calculations = GetTestHydraulicBoundaryLocationCalculations(); + + base.Setup(); + } + + protected override object GetCalculationSelection(CalculationsView view, object selectedRowObject) + { + return new GrassCoverErosionOutwardsWaveHeightCalculationContext(((HydraulicBoundaryLocationRow) selectedRowObject).CalculatableObject); + } + + protected override CalculationsView ShowFullyConfiguredCalculationsView(Form form) + { + return ShowWaveHeightLocationsView(calculations, new ObservableTestAssessmentSectionStub(), 0.01, form); + } + + protected override ObservableList GetCalculationsInView(CalculationsView view) + { + return calculations; + } + } + } +} \ No newline at end of file Fisheye: Tag 036dbc232fd0151d7612ea584b3b46f419b74eae refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs =================================================================== diff -u -r7e42f569488ce8073fbe656e3cf8525a8bb2ad9d -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs) (revision 7e42f569488ce8073fbe656e3cf8525a8bb2ad9d) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -62,7 +62,7 @@ string expectedErrorMessage) { // Given - GrassCoverErosionOutwardsWaveHeightLocationsView view = ShowFullyConfiguredWaveHeightLocationsView(); + GrassCoverErosionOutwardsWaveHeightCalculationsView view = ShowFullyConfiguredWaveHeightLocationsView(); if (rowSelected) { @@ -93,7 +93,7 @@ Assert.AreEqual(expectedErrorMessage, errorProvider.GetError(button)); } - private GrassCoverErosionOutwardsWaveHeightLocationsView ShowFullyConfiguredWaveHeightLocationsView() + private GrassCoverErosionOutwardsWaveHeightCalculationsView ShowFullyConfiguredWaveHeightLocationsView() { var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { @@ -113,10 +113,10 @@ } }; - var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(calculations, - failureMechanism, - new AssessmentSection(AssessmentSectionComposition.Dike), - () => 0.01); + var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(calculations, + failureMechanism, + new AssessmentSection(AssessmentSectionComposition.Dike), + () => 0.01); testForm.Controls.Add(view); testForm.Show(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs =================================================================== diff -u -rc045873bae1b4daaf2325e9903dcf656702c24c1 -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision c045873bae1b4daaf2325e9903dcf656702c24c1) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -82,7 +82,7 @@ viewInfos, typeof(GrassCoverErosionOutwardsWaveHeightLocationsContext), typeof(IEnumerable), - typeof(GrassCoverErosionOutwardsWaveHeightLocationsView)); + typeof(GrassCoverErosionOutwardsWaveHeightCalculationsView)); } } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs =================================================================== diff -u -rce6d92729ff98bf874a8047f018c7d8756dc0d20 -r036dbc232fd0151d7612ea584b3b46f419b74eae --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs) (revision ce6d92729ff98bf874a8047f018c7d8756dc0d20) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs) (revision 036dbc232fd0151d7612ea584b3b46f419b74eae) @@ -54,10 +54,10 @@ ViewInfo info = GetInfo(plugin); // Assert - Assert.NotNull(info, "Expected a viewInfo definition for views with type {0}.", typeof(GrassCoverErosionOutwardsWaveHeightLocationsView)); + Assert.NotNull(info, "Expected a viewInfo definition for views with type {0}.", typeof(GrassCoverErosionOutwardsWaveHeightCalculationsView)); Assert.AreEqual(typeof(GrassCoverErosionOutwardsWaveHeightLocationsContext), info.DataType); Assert.AreEqual(typeof(IEnumerable), info.ViewDataType); - Assert.AreEqual(typeof(GrassCoverErosionOutwardsWaveHeightLocationsView), info.ViewType); + Assert.AreEqual(typeof(GrassCoverErosionOutwardsWaveHeightCalculationsView), info.ViewType); } } @@ -113,7 +113,7 @@ plugin.Activate(); // Call - var view = (GrassCoverErosionOutwardsWaveHeightLocationsView) info.CreateInstance(context); + var view = (GrassCoverErosionOutwardsWaveHeightCalculationsView) info.CreateInstance(context); // Assert Assert.AreSame(assessmentSection, view.AssessmentSection); @@ -175,10 +175,10 @@ plugin.Gui = gui; plugin.Activate(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - failureMechanism, - assessmentSection, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + failureMechanism, + assessmentSection, + () => 0.01)) { info.AfterCreate(view, data); @@ -207,10 +207,10 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - failureMechanism, - assessmentSection, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + failureMechanism, + assessmentSection, + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -246,10 +246,10 @@ }); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - failureMechanism, - assessmentSectionA, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + failureMechanism, + assessmentSectionA, + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -282,10 +282,10 @@ new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - new GrassCoverErosionOutwardsFailureMechanism(), - assessmentSection, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -323,10 +323,10 @@ new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionB); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - new GrassCoverErosionOutwardsFailureMechanism(), - assessmentSectionA, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSectionA, + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -355,10 +355,10 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new ObservableList(), - new GrassCoverErosionOutwardsFailureMechanism(), - assessmentSection, - () => 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightCalculationsView(new ObservableList(), + new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -375,7 +375,7 @@ private static ViewInfo GetInfo(PluginBase plugin) { - return plugin.GetViewInfos().FirstOrDefault(vi => vi.ViewType == typeof(GrassCoverErosionOutwardsWaveHeightLocationsView)); + return plugin.GetViewInfos().FirstOrDefault(vi => vi.ViewType == typeof(GrassCoverErosionOutwardsWaveHeightCalculationsView)); } } } \ No newline at end of file