Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj
===================================================================
diff -u -rd42451749e8feec1c96555eb81b1cd7d67e30146 -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.csproj) (revision d42451749e8feec1c96555eb81b1cd7d67e30146)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.csproj) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -32,6 +32,9 @@
AllRules.ruleset
+
+ False
+
@@ -95,6 +98,11 @@
Ringtoets.HydraRing.Data
False
+
+ {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70}
+ Ringtoets.HydraRing.IO
+ False
+
{C8383B76-B3F1-4E6E-B56C-527B469FA20A}
Ringtoets.Integration.Plugin
@@ -110,6 +118,11 @@
Ringtoets.Revetment.IO
False
+
+ {2331235F-1E56-4344-ACC2-191C22A39594}
+ Ringtoets.Revetment.Service
+ False
+
{567E0B69-5280-41CE-ADD6-443725A61C86}
Ringtoets.WaveImpactAsphaltCover.Data
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs
===================================================================
diff -u -rd42451749e8feec1c96555eb81b1cd7d67e30146 -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision d42451749e8feec1c96555eb81b1cd7d67e30146)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -37,7 +37,9 @@
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TreeNodeInfos;
using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.IO;
using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Service;
using Ringtoets.WaveImpactAsphaltCover.Data;
using Ringtoets.WaveImpactAsphaltCover.Forms;
using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
@@ -46,6 +48,7 @@
using Ringtoets.WaveImpactAsphaltCover.IO;
using Ringtoets.WaveImpactAsphaltCover.Service;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources;
using WaveImpactAsphaltCoverDataResources = Ringtoets.WaveImpactAsphaltCover.Data.Properties.Resources;
using WaveImpactAsphaltCoverFormsResources = Ringtoets.WaveImpactAsphaltCover.Forms.Properties.Resources;
@@ -316,8 +319,6 @@
.AddValidateAllCalculationsInGroupItem(nodeData,
c => ValidateAll(
c.WrappedData.GetCalculations().OfType(),
- c.FailureMechanism.GeneralInput,
- c.AssessmentSection.FailureMechanismContribution.Norm,
c.AssessmentSection.HydraulicBoundaryDatabase),
ValidateAllDataAvailableAndGetErrorMessageForCalculationGroup)
.AddPerformAllCalculationsInGroupItem(group, nodeData, CalculateAll, ValidateAllDataAvailableAndGetErrorMessageForCalculationGroup)
@@ -350,9 +351,24 @@
private string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection, WaveImpactAsphaltCoverFailureMechanism failureMechanism)
{
- // TODO WTI-856 Contextmenu item is now set to Enabled == false by returning !NullOrEmpty from this method.
+ if (!failureMechanism.Sections.Any())
+ {
+ return RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported;
+ }
- return "Er is geen vakindeling geïmporteerd.";
+ if (assessmentSection.HydraulicBoundaryDatabase == null)
+ {
+ return RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported;
+ }
+
+ string validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(assessmentSection.HydraulicBoundaryDatabase.FilePath);
+ if (!string.IsNullOrEmpty(validationProblem))
+ {
+ return string.Format(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_,
+ validationProblem);
+ }
+
+ return null;
}
private StrictContextMenuItem CreateGenerateWaveConditionsCalculationsItem(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext nodeData)
@@ -406,9 +422,12 @@
nodeData.WrappedData.NotifyObservers();
}
- private void ValidateAll(IEnumerable calculations, GeneralWaveConditionsInput generalInput, int norm, HydraulicBoundaryDatabase database)
+ private void ValidateAll(IEnumerable calculations, HydraulicBoundaryDatabase database)
{
- // TODO WTI-856
+ foreach (WaveImpactAsphaltCoverWaveConditionsCalculation calculation in calculations)
+ {
+ WaveConditionsCalculationService.Instance.Validate(calculation.InputParameters, database, calculation.Name);
+ }
}
private void CalculateAll(CalculationGroup group, WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext context)
@@ -487,8 +506,6 @@
{
c.WrappedData
},
- c.FailureMechanism.GeneralInput,
- c.AssessmentSection.FailureMechanismContribution.Norm,
c.AssessmentSection.HydraulicBoundaryDatabase),
ValidateAllDataAvailableAndGetErrorMessageForCalculation)
.AddPerformCalculationItem(calculation, nodeData, PerformCalculation)
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/Ringtoets.WaveImpactAsphaltCover.Service.csproj
===================================================================
diff -u -re2dbd70747659819d97614b9a73733babaa7b106 -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/Ringtoets.WaveImpactAsphaltCover.Service.csproj (.../Ringtoets.WaveImpactAsphaltCover.Service.csproj) (revision e2dbd70747659819d97614b9a73733babaa7b106)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/Ringtoets.WaveImpactAsphaltCover.Service.csproj (.../Ringtoets.WaveImpactAsphaltCover.Service.csproj) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -36,6 +36,9 @@
..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll
True
+
+ False
+
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/WaveImpactAsphaltCoverWaveConditionsCalculationActivity.cs
===================================================================
diff -u -r0bb11ec189709c999bee440a31c003f00b0a3a2b -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/WaveImpactAsphaltCoverWaveConditionsCalculationActivity.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivity.cs) (revision 0bb11ec189709c999bee440a31c003f00b0a3a2b)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Service/WaveImpactAsphaltCoverWaveConditionsCalculationActivity.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivity.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -87,7 +87,7 @@
protected override void OnRun()
{
- PerformRun(() => true,
+ PerformRun(() => WaveConditionsCalculationService.Instance.Validate(calculation.InputParameters, assessmentSection.HydraulicBoundaryDatabase, calculation.Name),
() => WaveImpactAsphaltCoverDataSynchronizationService.ClearWaveConditionsCalculationOutput(calculation),
() =>
{
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -r0d7efa62d16c64a925c63172e4d1bf1a4e0bf94f -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 0d7efa62d16c64a925c63172e4d1bf1a4e0bf94f)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -57,7 +57,7 @@
[TestFixture]
public class WaveImpactAsphaltCoverWaveConditionsCalculationContextTreeNodeInfoTest : NUnitFormTest
{
- //private const int validateMenuItemIndex = 2;
+ private const int validateMenuItemIndex = 2;
private const int clearOutputMenuItemIndex = 4;
@@ -401,301 +401,384 @@
// Assert expectancies are called in TearDown()
}
- // TODO WTI-856
- //[Test]
- //public void GivenFailureMechanismWithoutSections_ThenValidationItemDisabled()
- //{
- // // Given
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // var assessmentSection = mocks.Stub();
+ [Test]
+ public void GivenFailureMechanismWithoutSections_ThenValidationItemDisabled()
+ {
+ // Given
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var assessmentSection = mocks.Stub();
- // var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
- // {
- // Name = "A"
- // };
- // var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
- // failureMechanism,
- // assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var appFeatureCommandHandler = mocks.Stub();
- // var importHandler = mocks.Stub();
- // var exportHandler = mocks.Stub();
- // var viewCommands = mocks.Stub();
- // var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
- // importHandler,
- // exportHandler,
- // viewCommands,
- // context,
- // treeViewControl);
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
- // var gui = mocks.Stub();
- // gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- // {
- // // Then
- // TestHelper.AssertContextMenuStripContainsItem(contextMenu,
- // validateMenuItemIndex,
- // "&Valideren",
- // "Er is geen vakindeling geïmporteerd.",
- // RingtoetsCommonFormsResources.ValidateIcon,
- // false);
- // }
- // }
- //}
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Then
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Er is geen vakindeling geïmporteerd.",
+ RingtoetsCommonFormsResources.ValidateIcon,
+ false);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void GivenAssessmentSectionWithoutHydroDatabase_ThenValidationItemDisabled()
- //{
- // // Given
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("A", new[]
- // {
- // new Point2D(0, 0),
- // new Point2D(1, 1)
- // }));
- // var assessmentSection = mocks.Stub();
+ [Test]
+ public void GivenAssessmentSectionWithoutHydroDatabase_ThenValidationItemDisabled()
+ {
+ // Given
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+ var assessmentSection = mocks.Stub();
- // var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
- // {
- // Name = "A"
- // };
- // var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
- // failureMechanism,
- // assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var appFeatureCommandHandler = mocks.Stub();
- // var importHandler = mocks.Stub();
- // var exportHandler = mocks.Stub();
- // var viewCommands = mocks.Stub();
- // var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
- // importHandler,
- // exportHandler,
- // viewCommands,
- // context,
- // treeViewControl);
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
- // var gui = mocks.Stub();
- // gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- // {
- // // Then
- // TestHelper.AssertContextMenuStripContainsItem(contextMenu,
- // validateMenuItemIndex,
- // "&Valideren",
- // "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.",
- // RingtoetsCommonFormsResources.ValidateIcon,
- // false);
- // }
- // }
- //}
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Then
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.",
+ RingtoetsCommonFormsResources.ValidateIcon,
+ false);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void GivenAssessmentSectionWithoutValidPathForCalculation_ThenValidationItemDisabled()
- //{
- // // Given
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("A", new[]
- // {
- // new Point2D(0, 0),
- // new Point2D(1, 1)
- // }));
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ [Test]
+ public void GivenAssessmentSectionWithoutValidPathForCalculation_ThenValidationItemDisabled()
+ {
+ // Given
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
- // var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
- // {
- // Name = "A"
- // };
- // var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
- // failureMechanism,
- // assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var appFeatureCommandHandler = mocks.Stub();
- // var importHandler = mocks.Stub();
- // var exportHandler = mocks.Stub();
- // var viewCommands = mocks.Stub();
- // var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
- // importHandler,
- // exportHandler,
- // viewCommands,
- // context,
- // treeViewControl);
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
- // var gui = mocks.Stub();
- // gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- // {
- // // Then
- // TestHelper.AssertContextMenuStripContainsItem(contextMenu,
- // validateMenuItemIndex,
- // "&Valideren",
- // "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn.",
- // RingtoetsCommonFormsResources.ValidateIcon,
- // false);
- // }
- // }
- //}
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Then
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn.",
+ RingtoetsCommonFormsResources.ValidateIcon,
+ false);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void GivenAssessmentSectionWithValidPathForCalculation_ThenValidationItemEnabled()
- //{
- // // Given
- // string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
- // Path.Combine("HydraulicBoundaryLocationReader", "complete.sqlite"));
+ [Test]
+ public void GivenAssessmentSectionWithValidPathForCalculation_ThenValidationItemEnabled()
+ {
+ // Given
+ string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
+ Path.Combine("HydraulicBoundaryLocationReader", "complete.sqlite"));
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("A", new[]
- // {
- // new Point2D(0, 0),
- // new Point2D(1, 1)
- // }));
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = validHydroDatabasePath
- // };
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = validHydroDatabasePath
+ };
- // var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
- // {
- // Name = "A"
- // };
- // var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
- // failureMechanism,
- // assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var appFeatureCommandHandler = mocks.Stub();
- // var importHandler = mocks.Stub();
- // var exportHandler = mocks.Stub();
- // var viewCommands = mocks.Stub();
- // var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
- // importHandler,
- // exportHandler,
- // viewCommands,
- // context,
- // treeViewControl);
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
- // var gui = mocks.Stub();
- // gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- // {
- // // Then
- // TestHelper.AssertContextMenuStripContainsItem(contextMenu,
- // validateMenuItemIndex,
- // "&Valideren",
- // "Valideer de invoer voor deze berekening.",
- // RingtoetsCommonFormsResources.ValidateIcon);
- // }
- // }
- //}
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Then
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Valideer de invoer voor deze berekening.",
+ RingtoetsCommonFormsResources.ValidateIcon);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void GivenValidCalculation_WhenValidating_ThenCalculationPassesValidation()
- //{
- // // Given
- // string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
- // Path.Combine("HydraulicBoundaryLocationReader", "complete.sqlite"));
+ [Test]
+ public void GivenValidCalculation_WhenValidating_ThenCalculationPassesValidation()
+ {
+ // Given
+ string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
+ Path.Combine("HydraulicBoundaryLocationReader", "complete.sqlite"));
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("A", new[]
- // {
- // new Point2D(0, 0),
- // new Point2D(1, 1)
- // }));
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = validHydroDatabasePath
- // };
- // assessmentSection.Stub(a => a.Id).Return("someId");
- // assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
- // new FailureMechanismContribution(Enumerable.Empty(), 100, 20));
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = validHydroDatabasePath
+ };
+ assessmentSection.Stub(a => a.Id).Return("someId");
+ assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
+ new FailureMechanismContribution(Enumerable.Empty(), 100, 20));
- // var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
- // {
- // Name = "A"
- // };
- // var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
- // failureMechanism,
- // assessmentSection);
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 1, 1)
+ {
+ DesignWaterLevel = (RoundedDouble) 12.0
+ },
+ LowerBoundaryRevetment = (RoundedDouble) 1.0,
+ UpperBoundaryRevetment = (RoundedDouble) 10.0,
+ StepSize = WaveConditionsInputStepSize.One,
+ LowerBoundaryWaterLevels = (RoundedDouble) 1.0,
+ UpperBoundaryWaterLevels = (RoundedDouble) 10.0
+ }
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var appFeatureCommandHandler = mocks.Stub();
- // var importHandler = mocks.Stub();
- // var exportHandler = mocks.Stub();
- // var viewCommands = mocks.Stub();
- // var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
- // importHandler,
- // exportHandler,
- // viewCommands,
- // context,
- // treeViewControl);
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
- // var gui = mocks.Stub();
- // gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- // {
- // // Precondition
- // TestHelper.AssertContextMenuStripContainsItem(contextMenu,
- // validateMenuItemIndex,
- // "&Valideren",
- // "Valideer de invoer voor deze berekening.",
- // RingtoetsCommonFormsResources.ValidateIcon);
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Precondition
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Valideer de invoer voor deze berekening.",
+ RingtoetsCommonFormsResources.ValidateIcon);
- // // When
- // ToolStripItem validateMenuItem = contextMenu.Items[validateMenuItemIndex];
- // Action call = () => validateMenuItem.PerformClick();
+ // When
+ ToolStripItem validateMenuItem = contextMenu.Items[validateMenuItemIndex];
+ Action call = () => validateMenuItem.PerformClick();
- // // Then
- // TestHelper.AssertLogMessages(call, logMessages =>
- // {
- // var messages = logMessages.ToArray();
- // Assert.AreEqual(2, messages.Length);
- // StringAssert.StartsWith("Validatie van 'A' gestart om: ", messages[0]);
- // StringAssert.StartsWith("Validatie van 'A' beëindigd om: ", messages[1]);
- // });
- // }
- // }
- //}
+ // Then
+ TestHelper.AssertLogMessages(call, logMessages =>
+ {
+ var messages = logMessages.ToArray();
+ Assert.AreEqual(2, messages.Length);
+ StringAssert.StartsWith("Validatie van 'A' gestart om: ", messages[0]);
+ StringAssert.StartsWith("Validatie van 'A' beëindigd om: ", messages[1]);
+ });
+ }
+ }
+ }
[Test]
+ public void GivenInValidCalculation_WhenValidating_ThenCalculationPassesValidation()
+ {
+ // Given
+ string validHydroDatabasePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.IO,
+ Path.Combine("HydraulicBoundaryLocationReader", "complete.sqlite"));
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ }));
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = validHydroDatabasePath
+ };
+ assessmentSection.Stub(a => a.Id).Return("someId");
+ assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
+ new FailureMechanismContribution(Enumerable.Empty(), 100, 20));
+
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ };
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(calculation,
+ failureMechanism,
+ assessmentSection);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var appFeatureCommandHandler = mocks.Stub();
+ var importHandler = mocks.Stub();
+ var exportHandler = mocks.Stub();
+ var viewCommands = mocks.Stub();
+ var menuBuilderMock = new ContextMenuBuilder(appFeatureCommandHandler,
+ importHandler,
+ exportHandler,
+ viewCommands,
+ context,
+ treeViewControl);
+
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilderMock);
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Precondition
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu,
+ validateMenuItemIndex,
+ "&Valideren",
+ "Valideer de invoer voor deze berekening.",
+ RingtoetsCommonFormsResources.ValidateIcon);
+
+ // When
+ ToolStripItem validateMenuItem = contextMenu.Items[validateMenuItemIndex];
+ Action call = () => validateMenuItem.PerformClick();
+
+ // Then
+ TestHelper.AssertLogMessages(call, logMessages =>
+ {
+ var messages = logMessages.ToArray();
+ Assert.AreEqual(3, messages.Length);
+ StringAssert.StartsWith("Validatie van 'A' gestart om: ", messages[0]);
+ StringAssert.StartsWith("Validatie mislukt: Er is geen hydraulische randvoorwaardenlocatie geselecteerd.", messages[1]);
+ StringAssert.StartsWith("Validatie van 'A' beëindigd om: ", messages[2]);
+ });
+ }
+ }
+ }
+
+ [Test]
public void GivenAnyCalculation_ThenCalculateItemEnabled()
{
// Given
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r8e0924d08a2377125c21114d088b6091bf1eb5fc -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 8e0924d08a2377125c21114d088b6091bf1eb5fc)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -606,307 +607,338 @@
}
}
- // TODO WTI-856
- //[Test]
- //public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled()
- //{
- // // Setup
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("", new[]
- // {
- // new Point2D(0, 0)
- // }));
- // var group = new CalculationGroup();
- // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
- // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
- // var assessmentSection = mocks.Stub();
- // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
- // failureMechanism,
- // assessmentSection);
- // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
- // failureMechanism,
- // assessmentSection);
+ [Test]
+ public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled()
+ {
+ // Setup
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+ var group = new CalculationGroup();
+ group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
+ failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
+ var assessmentSection = mocks.Stub();
+ var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
+ failureMechanism,
+ assessmentSection);
+ var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
+ failureMechanism,
+ assessmentSection);
- // var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
- // var gui = mocks.Stub();
- // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ var gui = mocks.Stub();
+ gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // // Call
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
- // {
- // // Assert
- // ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations];
- // ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations];
- // Assert.IsFalse(validateItem.Enabled);
- // Assert.IsFalse(calculateItem.Enabled);
- // Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, calculateItem.ToolTipText);
- // Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, validateItem.ToolTipText);
- // }
- // }
- //}
+ // Call
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
+ {
+ // Assert
+ ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations];
+ ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations];
+ Assert.IsFalse(validateItem.Enabled);
+ Assert.IsFalse(calculateItem.Enabled);
+ Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, calculateItem.ToolTipText);
+ Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, validateItem.ToolTipText);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled()
- //{
- // // Setup
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("", new[]
- // {
- // new Point2D(0, 0)
- // }));
- // var group = new CalculationGroup();
- // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
- // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = ""
- // };
- // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
- // failureMechanism,
- // assessmentSection);
- // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
- // failureMechanism,
- // assessmentSection);
+ [Test]
+ public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled()
+ {
+ // Setup
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+ var group = new CalculationGroup();
+ group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
+ failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = ""
+ };
+ var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
+ failureMechanism,
+ assessmentSection);
+ var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
+ failureMechanism,
+ assessmentSection);
- // var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
- // var gui = mocks.Stub();
- // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ var gui = mocks.Stub();
+ gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
- // mocks.ReplayAll();
+ mocks.ReplayAll();
- // plugin.Gui = gui;
+ plugin.Gui = gui;
- // // Call
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
- // {
- // // Assert
- // ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations];
- // ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations];
- // Assert.IsFalse(validateItem.Enabled);
- // Assert.IsFalse(calculateItem.Enabled);
- // var message = "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn.";
- // Assert.AreEqual(message, calculateItem.ToolTipText);
- // Assert.AreEqual(message, validateItem.ToolTipText);
- // }
- // }
- //}
+ // Call
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
+ {
+ // Assert
+ ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations];
+ ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations];
+ Assert.IsFalse(validateItem.Enabled);
+ Assert.IsFalse(calculateItem.Enabled);
+ var message = "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn.";
+ Assert.AreEqual(message, calculateItem.ToolTipText);
+ Assert.AreEqual(message, validateItem.ToolTipText);
+ }
+ }
+ }
- // TODO WTI-856
- //[Test]
- //public void ContextMenuStrip_TwoCalculationsClickOnValidateAllInGroup_ValidationMessagesLogged()
- //{
- // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+ [Test]
+ public void ContextMenuStrip_TwoCalculationsClickOnValidateAllInGroup_ValidationMessagesLogged()
+ {
+ string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
- // };
- // assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
- // new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
+ var assessmentSection = mocks.Stub();
+ assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
+ };
+ assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
+ new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
- // var group = new CalculationGroup();
- // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
- // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
+ var calculationA = new WaveImpactAsphaltCoverWaveConditionsCalculation()
+ {
+ Name = "A",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 1, 1)
+ {
+ DesignWaterLevel = (RoundedDouble) 12.0
+ },
+ LowerBoundaryRevetment = (RoundedDouble) 1.0,
+ UpperBoundaryRevetment = (RoundedDouble) 10.0,
+ StepSize = WaveConditionsInputStepSize.One,
+ LowerBoundaryWaterLevels = (RoundedDouble) 1.0,
+ UpperBoundaryWaterLevels = (RoundedDouble) 10.0
+ }
+ };
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("", new[]
- // {
- // new Point2D(0, 0)
- // }));
- // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
- // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
- // failureMechanism,
- // assessmentSection);
- // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
- // failureMechanism,
- // assessmentSection);
+ var calculationB = new WaveImpactAsphaltCoverWaveConditionsCalculation()
+ {
+ Name = "B",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 1, 1)
+ {
+ DesignWaterLevel = (RoundedDouble) 12.0
+ },
+ LowerBoundaryRevetment = (RoundedDouble) 1.0,
+ UpperBoundaryRevetment = (RoundedDouble) 10.0,
+ StepSize = WaveConditionsInputStepSize.One,
+ LowerBoundaryWaterLevels = (RoundedDouble) 1.0,
+ UpperBoundaryWaterLevels = (RoundedDouble) 10.0
+ }
+ };
- // var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var group = new CalculationGroup();
+ group.Children.Add(calculationA);
+ group.Children.Add(calculationB);
- // // Setup
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var gui = mocks.Stub();
- // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(0, 0)
+ }));
+ failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
+ var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
+ failureMechanism,
+ assessmentSection);
+ var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
+ failureMechanism,
+ assessmentSection);
- // mocks.ReplayAll();
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
- // plugin.Gui = gui;
+ // Setup
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
- // {
- // // Call
- // Action test = () => contextMenu.Items[4].PerformClick();
+ mocks.ReplayAll();
- // // Assert
- // TestHelper.AssertLogMessages(test, m =>
- // {
- // var messages = m.ToArray();
- // Assert.AreEqual(4, messages.Length);
- // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' gestart om: ", messages[0]);
- // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' beëindigd om: ", messages[1]);
- // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' gestart om: ", messages[2]);
- // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' beëindigd om: ", messages[3]);
- // });
- // }
- // }
- //}
+ plugin.Gui = gui;
- // TODO WTI-808
- //[Test]
- //public void ContextMenuStrip_TwoCalculationsClickOnCalculateAllInGroup_MessagesLogged()
- //{
- // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
+ {
+ // Call
+ Action test = () => contextMenu.Items[4].PerformClick();
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
- // };
- // assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
- // new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
- // assessmentSection.Stub(a => a.Id).Return("someId");
+ // Assert
+ TestHelper.AssertLogMessages(test, m =>
+ {
+ var messages = m.ToArray();
+ Assert.AreEqual(4, messages.Length);
+ StringAssert.StartsWith("Validatie van 'A' gestart om: ", messages[0]);
+ StringAssert.StartsWith("Validatie van 'A' beëindigd om: ", messages[1]);
+ StringAssert.StartsWith("Validatie van 'B' gestart om: ", messages[2]);
+ StringAssert.StartsWith("Validatie van 'B' beëindigd om: ", messages[3]);
+ });
+ }
+ }
+ }
- // var observerA = mocks.StrictMock();
- // observerA.Expect(o => o.UpdateObserver());
- // var observerB = mocks.StrictMock();
- // observerB.Expect(o => o.UpdateObserver());
-
- // var group = new CalculationGroup();
- // var calculationA = GetValidCalculation();
- // var calculationB = GetValidCalculation();
- // calculationA.Attach(observerA);
- // calculationB.Attach(observerB);
- // group.Children.Add(calculationA);
- // group.Children.Add(calculationB);
-
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("", new[]
- // {
- // new Point2D(0, 0)
- // }));
- // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
- // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
- // failureMechanism,
- // assessmentSection);
- // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
- // failureMechanism,
- // assessmentSection);
-
- // var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
-
- // DialogBoxHandler = (name, wnd) =>
- // {
- // // Expect an activity dialog which is automatically closed
- // };
-
- // // Setup
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var mainWindow = mocks.Stub();
-
- // var gui = mocks.Stub();
- // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
- // gui.Stub(g => g.MainWindow).Return(mainWindow);
-
- // mocks.ReplayAll();
-
- // plugin.Gui = gui;
-
- // using (new HydraRingCalculationServiceConfig())
- // using (new WaveConditionsCalculationServiceConfig())
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
- // {
- // // Call
- // Action test = () => contextMenu.Items[5].PerformClick();
-
- // // Assert
- // TestHelper.AssertLogMessages(test, m =>
- // {
- // var messages = m.ToArray();
- // Assert.AreEqual(30, messages.Length);
- // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[0]);
- // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[13]);
- // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[14]);
- // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[27]);
- // Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[28]);
- // Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[29]);
- // });
- // }
- // }
- //}
-
// TODO WTI-808
- //[Test]
- //public void ContextMenuStrip_NoCalculations_ClearAllOutputItemDisabled()
- //{
- // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+// [Test]
+// public void ContextMenuStrip_TwoCalculationsClickOnCalculateAllInGroup_MessagesLogged()
+// {
+// string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+//
+// var assessmentSection = mocks.Stub();
+// assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+// {
+// FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
+// };
+// assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
+// new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
+// assessmentSection.Stub(a => a.Id).Return("someId");
+//
+// var observerA = mocks.StrictMock();
+// observerA.Expect(o => o.UpdateObserver());
+// var observerB = mocks.StrictMock();
+// observerB.Expect(o => o.UpdateObserver());
+//
+// var group = new CalculationGroup();
+// var calculationA = GetValidCalculation();
+// var calculationB = GetValidCalculation();
+// calculationA.Attach(observerA);
+// calculationB.Attach(observerB);
+// group.Children.Add(calculationA);
+// group.Children.Add(calculationB);
+//
+// var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+// failureMechanism.AddSection(new FailureMechanismSection("", new[]
+// {
+// new Point2D(0, 0)
+// }));
+// failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
+// var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
+// failureMechanism,
+// assessmentSection);
+// var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
+// failureMechanism,
+// assessmentSection);
+//
+// var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+//
+// DialogBoxHandler = (name, wnd) =>
+// {
+// // Expect an activity dialog which is automatically closed
+// };
+//
+// // Setup
+// using (var treeViewControl = new TreeViewControl())
+// {
+// var mainWindow = mocks.Stub();
+//
+// var gui = mocks.Stub();
+// gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+// gui.Stub(g => g.MainWindow).Return(mainWindow);
+//
+// mocks.ReplayAll();
+//
+// plugin.Gui = gui;
+//
+// using (new HydraRingCalculationServiceConfig())
+// using (new WaveConditionsCalculationServiceConfig())
+// using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
+// {
+// // Call
+// Action test = () => contextMenu.Items[5].PerformClick();
+//
+// // Assert
+// TestHelper.AssertLogMessages(test, m =>
+// {
+// var messages = m.ToArray();
+// Assert.AreEqual(30, messages.Length);
+// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[0]);
+// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[13]);
+// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[14]);
+// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[27]);
+// Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[28]);
+// Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[29]);
+// });
+// }
+// }
+// }
+//
+// // TODO WTI-808
+// [Test]
+// public void ContextMenuStrip_NoCalculations_ClearAllOutputItemDisabled()
+// {
+// string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation");
+//
+// var assessmentSection = mocks.Stub();
+// assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+// {
+// FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
+// };
+// assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
+// new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
+// assessmentSection.Stub(a => a.Id).Return("someId");
+//
+// var group = new CalculationGroup();
+//
+// var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+// failureMechanism.AddSection(new FailureMechanismSection("", new[]
+// {
+// new Point2D(0, 0)
+// }));
+// failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
+// var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
+// failureMechanism,
+// assessmentSection);
+// var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
+// failureMechanism,
+// assessmentSection);
+//
+// var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+//
+// // Setup
+// using (var treeViewControl = new TreeViewControl())
+// {
+// var mainWindow = mocks.Stub();
+//
+// var gui = mocks.Stub();
+// gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+// gui.Stub(g => g.MainWindow).Return(mainWindow);
+//
+// mocks.ReplayAll();
+//
+// plugin.Gui = gui;
+//
+// using (new HydraRingCalculationServiceConfig())
+// using (new WaveConditionsCalculationServiceConfig())
+// using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
+// {
+// // Call
+// var clearAllOutputItem = contextMenu.Items[5];
+//
+// // Assert
+// Assert.IsFalse(clearAllOutputItem.Enabled);
+// }
+// }
+// }
- // var assessmentSection = mocks.Stub();
- // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
- // {
- // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite")
- // };
- // assessmentSection.Stub(a => a.FailureMechanismContribution).Return(
- // new FailureMechanismContribution(Enumerable.Empty(), 30, 2));
- // assessmentSection.Stub(a => a.Id).Return("someId");
-
- // var group = new CalculationGroup();
-
- // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
- // failureMechanism.AddSection(new FailureMechanismSection("", new[]
- // {
- // new Point2D(0, 0)
- // }));
- // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group);
- // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group,
- // failureMechanism,
- // assessmentSection);
- // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup,
- // failureMechanism,
- // assessmentSection);
-
- // var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
-
- // // Setup
- // using (var treeViewControl = new TreeViewControl())
- // {
- // var mainWindow = mocks.Stub();
-
- // var gui = mocks.Stub();
- // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
- // gui.Stub(g => g.MainWindow).Return(mainWindow);
-
- // mocks.ReplayAll();
-
- // plugin.Gui = gui;
-
- // using (new HydraRingCalculationServiceConfig())
- // using (new WaveConditionsCalculationServiceConfig())
- // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
- // {
- // // Call
- // var clearAllOutputItem = contextMenu.Items[5];
-
- // // Assert
- // Assert.IsFalse(clearAllOutputItem.Enabled);
- // }
- // }
- //}
-
[Test]
public void ContextMenuStrip_TwoCalculationsWithoutOutput_ClearAllOutputItemDisabled()
{
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs
===================================================================
diff -u -r14a346e335356ca0a7403cfc940610f739a6362e -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 14a346e335356ca0a7403cfc940610f739a6362e)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Integration.Test/WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationActivityIntegrationTest.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3)
@@ -156,10 +156,13 @@
TestHelper.AssertLogMessages(call, messages =>
{
var msgs = messages.ToArray();
- Assert.AreEqual(11, msgs.Length);
- StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]);
+ Assert.AreEqual(13, msgs.Length);
- int i = 0;
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]);
+ StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]);
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[2]);
+
+ int i = 2;
foreach (var waterLevel in calculation.InputParameters.WaterLevels)
{
StringAssert.StartsWith(string.Format("Berekening '{0}' voor waterstand '{1}' gestart om: ", calculation.Name, waterLevel), msgs[i + 1]);
@@ -169,7 +172,7 @@
i = i + 3;
}
- StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[10]);
+ StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[12]);
});
Assert.AreEqual(ActivityState.Failed, activity.State);
}