Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 7d89262d3b971dceec1e987e22d0027bf675c196)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -441,8 +441,8 @@
-
-
+
+
@@ -502,7 +502,7 @@
-
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs
===================================================================
diff -u -r0d495f2706215f1b75da521c905eb6105f2f8a34 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 0d495f2706215f1b75da521c905eb6105f2f8a34)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -93,7 +93,7 @@
entity.FailureMechanismEntities.Add(section.WaterPressureAsphaltCover.Create(registry));
entity.FailureMechanismEntities.Add(section.ClosingStructures.Create(registry));
entity.FailureMechanismEntities.Add(section.MacroStabilityInwards.Create(registry));
- entity.FailureMechanismEntities.Add(section.MacrostabilityOutwards.Create(registry));
+ entity.FailureMechanismEntities.Add(section.MacroStabilityOutwards.Create(registry));
entity.FailureMechanismEntities.Add(section.WaveImpactAsphaltCover.Create(registry));
entity.FailureMechanismEntities.Add(section.GrassCoverErosionOutwards.Create(registry));
entity.FailureMechanismEntities.Add(section.GrassCoverSlipOffInwards.Create(registry));
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensions.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,62 @@
+// 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 Application.Ringtoets.Storage.DbContext;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Create.MacrostabilityOutwards
+{
+ ///
+ /// Extension methods for related to creating a .
+ ///
+ internal static class MacroStabilityOutwardsFailureMechanismCreateExtensions
+ {
+ ///
+ /// Creates a based on the information of the .
+ ///
+ /// The failure mechanism to create a database entity for.
+ /// The object keeping track of create operations.
+ /// A new .
+ /// Thrown when is null.
+ internal static FailureMechanismEntity Create(this MacroStabilityOutwardsFailureMechanism mechanism, PersistenceRegistry registry)
+ {
+ FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.MacroStabilityOutwards, registry);
+ AddEntitiesForSectionResults(mechanism.SectionResults, registry);
+
+ return entity;
+ }
+
+ private static void AddEntitiesForSectionResults(
+ IEnumerable sectionResults,
+ PersistenceRegistry registry)
+ {
+ foreach (MacroStabilityOutwardsFailureMechanismSectionResult macroStabilityOutwardsFailureMechanismSectionResult in sectionResults)
+ {
+ MacrostabilityOutwardsSectionResultEntity sectionResultEntity = macroStabilityOutwardsFailureMechanismSectionResult.Create();
+ FailureMechanismSectionEntity section = registry.Get(macroStabilityOutwardsFailureMechanismSectionResult.Section);
+ section.MacrostabilityOutwardsSectionResultEntities.Add(sectionResultEntity);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,51 @@
+// 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 Application.Ringtoets.Storage.DbContext;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Create.MacrostabilityOutwards
+{
+ ///
+ /// Extension methods for related to creating a
+ /// .
+ ///
+ internal static class MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensions
+ {
+ ///
+ /// Creates a based on the information of the .
+ ///
+ /// The result to create a database entity for.
+ /// A new .
+ internal static MacrostabilityOutwardsSectionResultEntity Create(this MacroStabilityOutwardsFailureMechanismSectionResult result)
+ {
+ var sectionResultEntity = new MacrostabilityOutwardsSectionResultEntity
+ {
+ LayerOne = Convert.ToByte(result.AssessmentLayerOne),
+ LayerTwoA = result.AssessmentLayerTwoA.ToNaNAsNull(),
+ LayerThree = result.AssessmentLayerThree.ToNaNAsNull()
+ };
+
+ return sectionResultEntity;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismType.cs
===================================================================
diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismType.cs (.../FailureMechanismType.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/DbContext/FailureMechanismType.cs (.../FailureMechanismType.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -89,7 +89,7 @@
///
/// Macrostabiliteit buitenwaarts - STBU
///
- MacrostabilityOutwards = 13,
+ MacroStabilityOutwards = 13,
///
/// Microstabiliteit - STMI
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs
===================================================================
diff -u -ra8e4d7054ebef465eb8647d2c90da9a4d52f63b9 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision a8e4d7054ebef465eb8647d2c90da9a4d52f63b9)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/AssessmentSectionEntityReadExtensions.cs (.../AssessmentSectionEntityReadExtensions.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -80,7 +80,7 @@
entity.ReadWaterPressureAsphaltCoverFailureMechanism(assessmentSection, collector);
entity.ReadClosingStructuresFailureMechanism(assessmentSection, collector);
entity.ReadMacroStabilityInwardsFailureMechanism(assessmentSection, collector);
- entity.ReadMacrostabilityOutwardsFailureMechanism(assessmentSection, collector);
+ entity.ReadMacroStabilityOutwardsFailureMechanism(assessmentSection, collector);
entity.ReadWaveImpactAsphaltCoverFailureMechanism(assessmentSection, collector);
entity.ReadGrassCoverErosionOutwardsFailureMechanism(assessmentSection, collector);
entity.ReadGrassCoverSlipOffInwardsFailureMechanism(assessmentSection, collector);
@@ -191,10 +191,10 @@
macroStabilityInwardsFailureMechanismEntity?.ReadAsMacroStabilityInwardsFailureMechanism(assessmentSection.MacroStabilityInwards, collector);
}
- private static void ReadMacrostabilityOutwardsFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
+ private static void ReadMacroStabilityOutwardsFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
{
- FailureMechanismEntity macrostabilityOutwardsFailureMechanismEntity = GetFailureMechanismEntityOfType(entity, FailureMechanismType.MacrostabilityOutwards);
- macrostabilityOutwardsFailureMechanismEntity?.ReadAsMacrostabilityOutwardsFailureMechanism(assessmentSection.MacrostabilityOutwards, collector);
+ FailureMechanismEntity macrostabilityOutwardsFailureMechanismEntity = GetFailureMechanismEntityOfType(entity, FailureMechanismType.MacroStabilityOutwards);
+ macrostabilityOutwardsFailureMechanismEntity?.ReadAsMacroStabilityOutwardsFailureMechanism(assessmentSection.MacroStabilityOutwards, collector);
}
private static void ReadWaveImpactAsphaltCoverFailureMechanism(this AssessmentSectionEntity entity, AssessmentSection assessmentSection, ReadConversionCollector collector)
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs
===================================================================
diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 7d89262d3b971dceec1e987e22d0027bf675c196)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -581,30 +581,30 @@
#endregion
- #region Macrostability Outwards
+ #region MacroStability Outwards
///
- /// Read the and use the information to update a .
+ /// Read the and use the information to update a .
///
- /// The to create for.
+ /// The to create for.
/// The target of the read operation.
/// The object keeping track of read operations.
- internal static void ReadAsMacrostabilityOutwardsFailureMechanism(this FailureMechanismEntity entity,
- MacrostabilityOutwardsFailureMechanism failureMechanism,
+ internal static void ReadAsMacroStabilityOutwardsFailureMechanism(this FailureMechanismEntity entity,
+ MacroStabilityOutwardsFailureMechanism failureMechanism,
ReadConversionCollector collector)
{
entity.ReadCommonFailureMechanismProperties(failureMechanism, collector);
entity.ReadMacrostabilityOutwardsMechanismSectionResults(failureMechanism, collector);
}
private static void ReadMacrostabilityOutwardsMechanismSectionResults(this FailureMechanismEntity entity,
- MacrostabilityOutwardsFailureMechanism failureMechanism,
+ MacroStabilityOutwardsFailureMechanism failureMechanism,
ReadConversionCollector collector)
{
foreach (MacrostabilityOutwardsSectionResultEntity sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities))
{
FailureMechanismSection failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity);
- MacrostabilityOutwardsFailureMechanismSectionResult result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection));
+ MacroStabilityOutwardsFailureMechanismSectionResult result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection));
sectionResultEntity.Read(result);
}
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityOutwardsSectionResultEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityOutwardsSectionResultEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityOutwardsSectionResultEntityReadExtensions.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,56 @@
+// 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 Application.Ringtoets.Storage.DbContext;
+using Core.Common.Base.Data;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Read
+{
+ ///
+ /// This class defines extension methods for read operations for a based on the
+ /// .
+ ///
+ internal static class MacroStabilityOutwardsSectionResultEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to update a
+ /// .
+ ///
+ /// The to create for.
+ /// The target of the read operation.
+ /// A new .
+ /// Thrown when is null.
+ internal static void Read(this MacrostabilityOutwardsSectionResultEntity entity, MacroStabilityOutwardsFailureMechanismSectionResult sectionResult)
+ {
+ if (sectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(sectionResult));
+ }
+
+ sectionResult.AssessmentLayerOne = (AssessmentLayerOneState) entity.LayerOne;
+ sectionResult.AssessmentLayerTwoA = (RoundedDouble) entity.LayerTwoA.ToNullAsNaN();
+ sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacrostabilityOutwardsSectionResultEntityReadExtensions.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -r7d89262d3b971dceec1e987e22d0027bf675c196 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 7d89262d3b971dceec1e987e22d0027bf675c196)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -162,8 +162,8 @@
-
-
+
+
@@ -227,7 +227,7 @@
-
+
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs
===================================================================
diff -u -r39e18750ccb61ad1f367279f9dac39a232d4f843 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision 39e18750ccb61ad1f367279f9dac39a232d4f843)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/AssessmentSectionCreateExtensionsTest.cs (.../AssessmentSectionCreateExtensionsTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -115,7 +115,7 @@
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.Piping));
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.GrassRevetmentTopErosionAndInwards));
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.MacroStabilityInwards));
- Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.MacrostabilityOutwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.MacroStabilityOutwards));
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.Microstability));
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StabilityStoneRevetment));
Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.WaveImpactOnAsphaltRevetment));
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,153 @@
+// 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.Linq;
+using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.Create.MacrostabilityOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Integration.Data.StandAlone;
+
+namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityOutwards
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.MacroStabilityOutwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.AreNotSame(originalInput, entity.InputComments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreNotSame(originalOutput, entity.OutputComments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreNotSame(originalNotRelevantText, entity.NotRelevantComments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ failureMechanism.AddSection(new TestFailureMechanismSection());
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities).Count());
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,94 @@
+// 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 Application.Ringtoets.Storage.Create.MacrostabilityOutwards;
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.TestUtil;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityOutwards
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random();
+ var assessmentLayerOneResult = random.NextEnumValue();
+ const double assessmentLayerTwoAResult = 0.2;
+ const double assessmentLayerThreeResult = 3.2;
+
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ AssessmentLayerOne = assessmentLayerOneResult,
+ AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult,
+ AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult
+ };
+
+ // Call
+ MacrostabilityOutwardsSectionResultEntity result = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne);
+ Assert.AreEqual(assessmentLayerTwoAResult, result.LayerTwoA);
+ Assert.AreEqual(assessmentLayerThreeResult, result.LayerThree);
+ }
+
+ [Test]
+ public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ AssessmentLayerTwoA = RoundedDouble.NaN
+ };
+
+ // Call
+ MacrostabilityOutwardsSectionResultEntity result = sectionResult.Create();
+
+ // Assert
+ Assert.IsNull(result.LayerTwoA);
+ }
+
+ [Test]
+ public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection())
+ {
+ AssessmentLayerThree = RoundedDouble.NaN
+ };
+
+ // Call
+ MacrostabilityOutwardsSectionResultEntity result = sectionResult.Create();
+
+ // Assert
+ Assert.IsNull(result.LayerThree);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs
===================================================================
diff -u -r9726c1ed2a69caa0792394721d1bcf6dc587f421 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 9726c1ed2a69caa0792394721d1bcf6dc587f421)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -325,8 +325,8 @@
expectedAssessmentSection.ClosingStructures.SectionResults,
actualAssessmentSection.ClosingStructures.SectionResults);
AssertFailureMechanismSectionResults(
- expectedAssessmentSection.MacrostabilityOutwards.SectionResults,
- actualAssessmentSection.MacrostabilityOutwards.SectionResults);
+ expectedAssessmentSection.MacroStabilityOutwards.SectionResults,
+ actualAssessmentSection.MacroStabilityOutwards.SectionResults);
AssertFailureMechanismSectionResults(
expectedAssessmentSection.MacroStabilityInwards.SectionResults,
actualAssessmentSection.MacroStabilityInwards.SectionResults);
@@ -400,8 +400,8 @@
}
private static void AssertFailureMechanismSectionResults(
- IEnumerable expectedSectionResults,
- IEnumerable actualSectionResults)
+ IEnumerable expectedSectionResults,
+ IEnumerable actualSectionResults)
{
AssertCollectionAndItems(expectedSectionResults,
actualSectionResults,
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs
===================================================================
diff -u -rf7036a73fff399ef3c8524ffe9099e9b8fcbf3d8 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision f7036a73fff399ef3c8524ffe9099e9b8fcbf3d8)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -1459,7 +1459,7 @@
FailureMechanismEntity macrostabilityOutwards = CreateFailureMechanismEntity(
macrostabilityOutwardsIsRelevant,
- FailureMechanismType.MacrostabilityOutwards);
+ FailureMechanismType.MacroStabilityOutwards);
FailureMechanismEntity microstability = CreateFailureMechanismEntity(
microstabilityIsRelevant,
FailureMechanismType.Microstability);
@@ -1499,7 +1499,7 @@
macrostabilityOutwards.InputComments,
macrostabilityOutwards.OutputComments,
macrostabilityOutwards.NotRelevantComments,
- section.MacrostabilityOutwards);
+ section.MacroStabilityOutwards);
AssertFailureMechanismEqual(microstabilityIsRelevant,
2,
microstability.InputComments,
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,82 @@
+// 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 Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+using Application.Ringtoets.Storage.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Application.Ringtoets.Storage.Test.Read
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsSectionResultEntityReadExtensionsTest
+ {
+ [Test]
+ public void Read_SectionResultIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var entity = new MacrostabilityOutwardsSectionResultEntity();
+
+ // Call
+ TestDelegate call = () => entity.Read(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sectionResult", paramName);
+ }
+
+ [Test]
+ [Combinatorial]
+ public void Read_ParameterValues_SectionResultWithParameterValues(
+ [Values(AssessmentLayerOneState.NotAssessed, AssessmentLayerOneState.NoVerdict,
+ AssessmentLayerOneState.Sufficient)]
+ AssessmentLayerOneState layerOne,
+ [Values(0.1, 0.2, null)] double? layerTwoA,
+ [Values(0.11, 0.22, null)] double? layerThree)
+ {
+ // Setup
+ var collector = new ReadConversionCollector();
+
+ var failureMechanismSectionEntity = new FailureMechanismSectionEntity();
+ collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection());
+ var entity = new MacrostabilityOutwardsSectionResultEntity
+ {
+ LayerThree = layerThree,
+ LayerTwoA = layerTwoA,
+ LayerOne = Convert.ToByte(layerOne),
+ FailureMechanismSectionEntity = failureMechanismSectionEntity
+ };
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection());
+
+ // Call
+ entity.Read(sectionResult);
+
+ // Assert
+ Assert.IsNotNull(sectionResult);
+ Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne);
+ Assert.AreEqual(layerTwoA ?? double.NaN, sectionResult.AssessmentLayerTwoA, 1e-6);
+ Assert.AreEqual(layerThree ?? double.NaN, sectionResult.AssessmentLayerThree, 1e-6);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacrostabilityOutwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs
===================================================================
diff -u -r9726c1ed2a69caa0792394721d1bcf6dc587f421 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 9726c1ed2a69caa0792394721d1bcf6dc587f421)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -158,8 +158,8 @@
SetSectionResults(stabilityPointStructuresFailureMechanism.SectionResults,
(StructuresCalculation) stabilityPointStructuresFailureMechanism.Calculations.First());
- AddSections(assessmentSection.MacrostabilityOutwards);
- SetSectionResults(assessmentSection.MacrostabilityOutwards.SectionResults);
+ AddSections(assessmentSection.MacroStabilityOutwards);
+ SetSectionResults(assessmentSection.MacroStabilityOutwards.SectionResults);
AddSections(assessmentSection.Microstability);
SetSectionResults(assessmentSection.Microstability.SectionResults);
AddSections(assessmentSection.WaterPressureAsphaltCover);
@@ -218,10 +218,10 @@
}
}
- private static void SetSectionResults(IEnumerable sectionResults)
+ private static void SetSectionResults(IEnumerable sectionResults)
{
var random = new Random(21);
- foreach (MacrostabilityOutwardsFailureMechanismSectionResult sectionResult in sectionResults)
+ foreach (MacroStabilityOutwardsFailureMechanismSectionResult sectionResult in sectionResults)
{
sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState();
sectionResult.AssessmentLayerTwoA = (RoundedDouble) random.NextDouble();
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs
===================================================================
diff -u -rbb7246a859710e284b10c855848be97b8bc0b463 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision bb7246a859710e284b10c855848be97b8bc0b463)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/AssessmentSection.cs (.../AssessmentSection.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -87,7 +87,7 @@
Piping = new PipingFailureMechanism();
GrassCoverErosionInwards = new GrassCoverErosionInwardsFailureMechanism();
MacroStabilityInwards = new MacroStabilityInwardsFailureMechanism();
- MacrostabilityOutwards = new MacrostabilityOutwardsFailureMechanism();
+ MacroStabilityOutwards = new MacroStabilityOutwardsFailureMechanism();
Microstability = new MicrostabilityFailureMechanism();
StabilityStoneCover = new StabilityStoneCoverFailureMechanism();
WaveImpactAsphaltCover = new WaveImpactAsphaltCoverFailureMechanism();
@@ -129,7 +129,7 @@
///
/// Gets the "Dijken en dammen - Macrostabiliteit buitenwaarts" failure mechanism.
///
- public MacrostabilityOutwardsFailureMechanism MacrostabilityOutwards { get; }
+ public MacroStabilityOutwardsFailureMechanism MacroStabilityOutwards { get; }
///
/// Gets the "Dijken en dammen - Microstabiliteit" failure mechanism.
@@ -234,7 +234,7 @@
yield return Piping;
yield return GrassCoverErosionInwards;
yield return MacroStabilityInwards;
- yield return MacrostabilityOutwards;
+ yield return MacroStabilityOutwards;
yield return Microstability;
yield return StabilityStoneCover;
yield return WaveImpactAsphaltCover;
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj
===================================================================
diff -u -r3b1be2b494c30728564f41d6d8d14fc6a762957d -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision 3b1be2b494c30728564f41d6d8d14fc6a762957d)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/Ringtoets.Integration.Data.csproj (.../Ringtoets.Integration.Data.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -14,11 +14,12 @@
-
+
+
-
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInput.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInput.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInput.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,36 @@
+// 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 Ringtoets.Common.Data.Probability;
+
+namespace Ringtoets.Integration.Data.StandAlone.Input
+{
+ ///
+ /// This class holds parameters which influence the probability estimate for a macro stability outwards assessment.
+ ///
+ public class MacroStabilityOutwardsProbabilityAssessmentInput : ProbabilityAssessmentInput
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public MacroStabilityOutwardsProbabilityAssessmentInput() : base(0.033, 50.0) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/MacroStabilityOutwardsFailureMechanism.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/MacroStabilityOutwardsFailureMechanism.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/MacroStabilityOutwardsFailureMechanism.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,84 @@
+// 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.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.Properties;
+using Ringtoets.Integration.Data.StandAlone.Input;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Ringtoets.Integration.Data.StandAlone
+{
+ ///
+ /// Model containing input and output needed to perform different levels of the
+ /// macro stability outwards failure mechanism.
+ ///
+ public class MacroStabilityOutwardsFailureMechanism : FailureMechanismBase, IHasSectionResults
+ {
+ private readonly List sectionResults;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public MacroStabilityOutwardsFailureMechanism()
+ : base(Resources.MacrostabilityOutwardFailureMechanism_DisplayName, Resources.MacrostabilityOutwardFailureMechanism_Code)
+ {
+ sectionResults = new List();
+ MacroStabilityOutwardsProbabilityAssessmentInput = new MacroStabilityOutwardsProbabilityAssessmentInput();
+ }
+
+ public override IEnumerable Calculations
+ {
+ get
+ {
+ yield break;
+ }
+ }
+
+ ///
+ /// Gets the general probabilistic assessment input parameters that apply to each calculation
+ /// in a semi-probabilistic assessment.
+ ///
+ public MacroStabilityOutwardsProbabilityAssessmentInput MacroStabilityOutwardsProbabilityAssessmentInput { get; }
+
+ public IEnumerable SectionResults
+ {
+ get
+ {
+ return sectionResults;
+ }
+ }
+
+ public override void AddSection(FailureMechanismSection section)
+ {
+ base.AddSection(section);
+
+ sectionResults.Add(new MacroStabilityOutwardsFailureMechanismSectionResult(section));
+ }
+
+ public override void ClearAllSections()
+ {
+ base.ClearAllSections();
+ sectionResults.Clear();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/MacrostabilityOutwardsFailureMechanism.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResult.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResult.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResult.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,80 @@
+// 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.Globalization;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Ringtoets.Common.Data.FailureMechanism;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+
+namespace Ringtoets.Integration.Data.StandAlone.SectionResults
+{
+ ///
+ /// This class holds information about the result of a calculation on section level for the
+ /// macro stability outwards failure mechanism.
+ ///
+ public class MacroStabilityOutwardsFailureMechanismSectionResult : FailureMechanismSectionResult
+ {
+ private static readonly Range validityRangeAssessmentLayerTwoA = new Range(0, 1);
+ private double assessmentLayerTwoA;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The for which the
+ /// will hold the result.
+ /// Thrown when is null.
+ public MacroStabilityOutwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section)
+ {
+ AssessmentLayerTwoA = double.NaN;
+ AssessmentLayerThree = RoundedDouble.NaN;
+ }
+
+ ///
+ /// Gets or sets the value for the detailed assessment of safety per failure mechanism section as a probability.
+ ///
+ /// Thrown when is not in range [0,1].
+ public double AssessmentLayerTwoA
+ {
+ get
+ {
+ return assessmentLayerTwoA;
+ }
+ set
+ {
+ if (!double.IsNaN(value) && !validityRangeAssessmentLayerTwoA.InRange(value))
+ {
+ string message = string.Format(RingtoetsCommonDataResources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_in_Range_0_,
+ validityRangeAssessmentLayerTwoA.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture));
+ throw new ArgumentException(message);
+ }
+
+ assessmentLayerTwoA = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the tailored assessment of safety.
+ ///
+ public RoundedDouble AssessmentLayerThree { get; set; }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResult.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/MacroStabilityOutwardsFailureMechanismProperties.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/MacroStabilityOutwardsFailureMechanismProperties.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/MacroStabilityOutwardsFailureMechanismProperties.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,174 @@
+// 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 Core.Common.Base.Data;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.Input;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of properties panel.
+ ///
+ public class MacroStabilityOutwardsFailureMechanismProperties : ObjectProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The instance to show the properties of.
+ /// Thrown when input parameter is null.
+ public MacroStabilityOutwardsFailureMechanismProperties(MacroStabilityOutwardsFailureMechanism data)
+ {
+ if (data == null)
+ {
+ throw new ArgumentNullException(nameof(data));
+ }
+
+ Data = data;
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ if (!data.IsRelevant && ShouldHidePropertyWhenFailureMechanismIrrelevant(propertyName))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool ShouldHidePropertyWhenFailureMechanismIrrelevant(string propertyName)
+ {
+ return nameof(A).Equals(propertyName)
+ || nameof(B).Equals(propertyName)
+ || nameof(SectionLength).Equals(propertyName)
+ || nameof(N).Equals(propertyName);
+ }
+
+ #region General
+
+ [PropertyOrder(1)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_Description))]
+ public string Name
+ {
+ get
+ {
+ return data.Name;
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_Description))]
+ public string Code
+ {
+ get
+ {
+ return data.Code;
+ }
+ }
+
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_Description))]
+ public bool IsRelevant
+ {
+ get
+ {
+ return data.IsRelevant;
+ }
+ }
+
+ #endregion
+
+ #region Semi-probabilistic parameters
+
+ [DynamicVisible]
+ [PropertyOrder(21)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_Description))]
+ public double A
+ {
+ get
+ {
+ return data.MacroStabilityOutwardsProbabilityAssessmentInput.A;
+ }
+ set
+ {
+ data.MacroStabilityOutwardsProbabilityAssessmentInput.A = value;
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(22)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_B_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_B_Description))]
+ public double B
+ {
+ get
+ {
+ return data.MacroStabilityOutwardsProbabilityAssessmentInput.B;
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(23)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ReferenceLine_Length_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ReferenceLine_Length_Description))]
+ public RoundedDouble SectionLength
+ {
+ get
+ {
+ return new RoundedDouble(2, data.MacroStabilityOutwardsProbabilityAssessmentInput.SectionLength);
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(24)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Rounded_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Rounded_Description))]
+ public RoundedDouble N
+ {
+ get
+ {
+ MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = data.MacroStabilityOutwardsProbabilityAssessmentInput;
+ return new RoundedDouble(2, probabilityAssessmentInput.GetSectionSpecificN(probabilityAssessmentInput.SectionLength));
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismContextProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismProperties.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismProperties.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismProperties.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,91 @@
+// 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 Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.FailureMechanism;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of properties panel.
+ ///
+ public class StandAloneFailureMechanismProperties : ObjectProperties
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The failure mechanism to show the properties for.
+ /// Thrown when is null.
+ public StandAloneFailureMechanismProperties(IFailureMechanism failureMechanism)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ Data = failureMechanism;
+ }
+
+ #region General
+
+ [PropertyOrder(1)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_Description))]
+ public string Name
+ {
+ get
+ {
+ return data.Name;
+ }
+ }
+
+ [PropertyOrder(2)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_Description))]
+ public string Code
+ {
+ get
+ {
+ return data.Code;
+ }
+ }
+
+ [PropertyOrder(3)]
+ [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))]
+ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_Description))]
+ public bool IsRelevant
+ {
+ get
+ {
+ return data.IsRelevant;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r8c7c25ee0b61c182e38073f56cb6376c511ccbf2 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 8c7c25ee0b61c182e38073f56cb6376c511ccbf2)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -39,10 +39,11 @@
+
-
+
@@ -82,7 +83,7 @@
-
+
@@ -94,7 +95,7 @@
UserControl
-
+
UserControl
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,78 @@
+// 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.ComponentModel;
+using Core.Common.Base.Data;
+using Ringtoets.Common.Forms.TypeConverters;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Ringtoets.Integration.Forms.Views.SectionResultRows
+{
+ ///
+ /// Class for displaying as a row in a grid view.
+ ///
+ public class MacroStabilityOutwardsSectionResultRow : FailureMechanismSectionResultRow
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The to wrap
+ /// so that it can be displayed as a row.
+ /// Thrown when is null.
+ public MacroStabilityOutwardsSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResult sectionResult) : base(sectionResult) {}
+
+ ///
+ /// Gets the assessment layer two a of the .
+ ///
+ /// Thrown when is
+ /// not in the range [0,1].
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double AssessmentLayerTwoA
+ {
+ get
+ {
+ return SectionResult.AssessmentLayerTwoA;
+ }
+ set
+ {
+ SectionResult.AssessmentLayerTwoA = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the value of the tailored assessment of safety.
+ ///
+ [TypeConverter(typeof(NoValueRoundedDoubleConverter))]
+ public RoundedDouble AssessmentLayerThree
+ {
+ get
+ {
+ return SectionResult.AssessmentLayerThree;
+ }
+ set
+ {
+ SectionResult.AssessmentLayerThree = value.ToPrecision(SectionResult.AssessmentLayerThree.NumberOfDecimalPlaces);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRow.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacroStabilityOutwardsResultView.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,82 @@
+// 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.Windows.Forms;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Ringtoets.Integration.Forms.Views.SectionResultRows;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Views.SectionResultViews
+{
+ ///
+ /// The view for a collection of .
+ ///
+ public class MacroStabilityOutwardsResultView : FailureMechanismResultView
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public MacroStabilityOutwardsResultView()
+ {
+ DataGridViewControl.CellFormatting += OnCellFormatting;
+ }
+
+ protected override object CreateFailureMechanismSectionResultRow(MacroStabilityOutwardsFailureMechanismSectionResult sectionResult)
+ {
+ return new MacroStabilityOutwardsSectionResultRow(sectionResult);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ DataGridViewControl.CellFormatting -= OnCellFormatting;
+
+ base.Dispose(disposing);
+ }
+
+ protected override void AddDataGridColumns()
+ {
+ base.AddDataGridColumns();
+
+ DataGridViewControl.AddTextBoxColumn(
+ nameof(MacroStabilityOutwardsSectionResultRow.AssessmentLayerTwoA),
+ RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_two_a);
+ DataGridViewControl.AddTextBoxColumn(
+ nameof(MacroStabilityOutwardsSectionResultRow.AssessmentLayerThree),
+ RingtoetsCommonFormsResources.FailureMechanismResultView_InitializeDataGridView_Assessment_layer_three);
+ }
+
+ private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs)
+ {
+ if (eventArgs.ColumnIndex > AssessmentLayerOneColumnIndex)
+ {
+ if (HasPassedLevelOne(eventArgs.RowIndex))
+ {
+ DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex);
+ }
+ else
+ {
+ DataGridViewControl.RestoreCell(eventArgs.RowIndex, eventArgs.ColumnIndex);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MacrostabilityOutwardsResultView.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -r62c0c80758d506b417ba3340e80b918419a6aa4d -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 62c0c80758d506b417ba3340e80b918419a6aa4d)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -222,7 +222,7 @@
assessmentSection)
),
new FailureMechanismContextAssociation(
- typeof(MacrostabilityOutwardsFailureMechanism),
+ typeof(MacroStabilityOutwardsFailureMechanism),
(mechanism, assessmentSection) => new FailureMechanismContext(
mechanism,
assessmentSection)
@@ -305,7 +305,10 @@
new FailureMechanismContributionNormChangeHandler(context.Parent),
new AssessmentSectionCompositionChangeHandler(Gui.ViewCommands))
};
- yield return new PropertyInfo, StandAloneFailureMechanismContextProperties>();
+ yield return new PropertyInfo, StandAloneFailureMechanismProperties>
+ {
+ CreateInstance = context => new StandAloneFailureMechanismProperties(context.WrappedData)
+ };
yield return new PropertyInfo, CalculationGroupContextProperties>
{
CreateInstance = context => new CalculationGroupContextProperties(context)
@@ -447,8 +450,8 @@
WaterPressureAsphaltCoverFailureMechanismSectionResult,
WaterPressureAsphaltCoverResultView>();
yield return CreateFailureMechanismResultViewInfo<
- MacrostabilityOutwardsFailureMechanismSectionResult,
- MacrostabilityOutwardsResultView>();
+ MacroStabilityOutwardsFailureMechanismSectionResult,
+ MacroStabilityOutwardsResultView>();
yield return new ViewInfo
{
@@ -747,7 +750,7 @@
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
yield return CreateFailureMechanismSectionResultTreeNodeInfo();
- yield return CreateFailureMechanismSectionResultTreeNodeInfo();
+ yield return CreateFailureMechanismSectionResultTreeNodeInfo();
yield return new TreeNodeInfo
{
@@ -1286,7 +1289,7 @@
var waveImpactAsphaltCover = nodeData as IHasSectionResults;
var closingStructures = nodeData as IHasSectionResults;
var macroStabilityInwards = nodeData as IHasSectionResults;
- var macrostabilityOutwards = nodeData as IHasSectionResults;
+ var macrostabilityOutwards = nodeData as IHasSectionResults;
var stabilityPointConstruction = nodeData as IHasSectionResults;
var failureMechanismSectionResultContexts = new object[2];
@@ -1365,7 +1368,7 @@
if (macrostabilityOutwards != null)
{
failureMechanismSectionResultContexts[0] =
- new FailureMechanismSectionResultContext(macrostabilityOutwards.SectionResults, nodeData);
+ new FailureMechanismSectionResultContext(macrostabilityOutwards.SectionResults, nodeData);
}
if (stabilityPointConstruction != null)
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs
===================================================================
diff -u -r44cf5bc0f292171637b0c91b74005effe4d2798c -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 44cf5bc0f292171637b0c91b74005effe4d2798c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/AssessmentSectionTest.cs (.../AssessmentSectionTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -127,7 +127,7 @@
Assert.NotNull(section.Piping);
Assert.NotNull(section.GrassCoverErosionInwards);
Assert.NotNull(section.MacroStabilityInwards);
- Assert.NotNull(section.MacrostabilityOutwards);
+ Assert.NotNull(section.MacroStabilityOutwards);
Assert.NotNull(section.Microstability);
Assert.NotNull(section.StabilityStoneCover);
Assert.NotNull(section.WaveImpactAsphaltCover);
@@ -288,7 +288,7 @@
assessmentSection.Piping,
assessmentSection.GrassCoverErosionInwards,
assessmentSection.MacroStabilityInwards,
- assessmentSection.MacrostabilityOutwards,
+ assessmentSection.MacroStabilityOutwards,
assessmentSection.Microstability,
assessmentSection.StabilityStoneCover,
assessmentSection.WaveImpactAsphaltCover,
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj
===================================================================
diff -u -r3b1be2b494c30728564f41d6d8d14fc6a762957d -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 3b1be2b494c30728564f41d6d8d14fc6a762957d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/Ringtoets.Integration.Data.Test.csproj (.../Ringtoets.Integration.Data.Test.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -21,15 +21,16 @@
-
+
+
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInputTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInputTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/Input/MacroStabilityOutwardsProbabilityAssessmentInputTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,44 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Integration.Data.StandAlone.Input;
+
+namespace Ringtoets.Integration.Data.Test.StandAlone.Input
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsProbabilityAssessmentInputTest
+ {
+ [Test]
+ public void Constructor_DefaultPropertiesSet()
+ {
+ // Call
+ var probabilityAssessmentInput = new MacroStabilityOutwardsProbabilityAssessmentInput();
+
+ // Assert
+ Assert.IsInstanceOf(probabilityAssessmentInput);
+ Assert.AreEqual(0.033, probabilityAssessmentInput.A);
+ Assert.AreEqual(50, probabilityAssessmentInput.B);
+ Assert.IsNaN(probabilityAssessmentInput.SectionLength);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/MacroStabilityOutwardsFailureMechanismTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/MacroStabilityOutwardsFailureMechanismTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/MacroStabilityOutwardsFailureMechanismTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,67 @@
+// 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.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Ringtoets.Integration.Data.Test.StandAlone
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismTest
+ {
+ [Test]
+ public void DefaultConstructor_Always_PropertiesSet()
+ {
+ // Call
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Assert
+ Assert.IsInstanceOf(failureMechanism);
+ Assert.IsInstanceOf>(failureMechanism);
+ Assert.AreEqual("Dijken en dammen - Macrostabiliteit buitenwaarts", failureMechanism.Name);
+ Assert.AreEqual("STBU", failureMechanism.Code);
+ CollectionAssert.IsEmpty(failureMechanism.Sections);
+ Assert.IsNotNull(failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput);
+
+ }
+
+ [Test]
+ public void AddSection_WithSection_AddedMacroStabilityOutwardsFailureMechanismSectionResult()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Call
+ failureMechanism.AddSection(new FailureMechanismSection("", new[]
+ {
+ new Point2D(2, 1)
+ }));
+
+ // Assert
+ Assert.AreEqual(1, failureMechanism.SectionResults.Count());
+ Assert.IsInstanceOf(failureMechanism.SectionResults.ElementAt(0));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/MacrostabilityOutwardsFailureMechanismTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResultTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResultTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacroStabilityOutwardsFailureMechanismSectionResultTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,111 @@
+// 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 Core.Common.Base.Data;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+
+namespace Ringtoets.Integration.Data.Test.StandAlone.SectionResults
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismSectionResultTest
+ {
+ [Test]
+ public void Constructor_WithParameters_ExpectedValues()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+
+ // Call
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+
+ // Assert
+ Assert.IsInstanceOf(result);
+ Assert.AreSame(section, result.Section);
+ Assert.IsNaN(result.AssessmentLayerTwoA);
+ Assert.IsNaN(result.AssessmentLayerThree);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(-20)]
+ [TestCase(-1e-6)]
+ [TestCase(1 + 1e-6)]
+ [TestCase(12)]
+ public void AssessmentLayerTwoA_ForInvalidValues_ThrowsException(double newValue)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+
+ // Call
+ TestDelegate test = () => result.AssessmentLayerTwoA = newValue;
+
+ // Assert
+ string message = Assert.Throws(test).Message;
+ const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen.";
+ Assert.AreEqual(expectedMessage, message);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1e-6)]
+ [TestCase(0.5)]
+ [TestCase(1 - 1e-6)]
+ [TestCase(1)]
+ [TestCase(double.NaN)]
+ public void AssessmentLayerTwoA_ForValidValues_NewValueSet(double newValue)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+
+ // Call
+ result.AssessmentLayerTwoA = newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.AssessmentLayerTwoA);
+ }
+
+ [Test]
+ [TestCase(double.NaN)]
+ [TestCase(double.PositiveInfinity)]
+ [TestCase(double.NegativeInfinity)]
+ [TestCase(5)]
+ [TestCase(0.5)]
+ public void AssessmentLayerThree_SetNewValue_ReturnsNewValue(double newValue)
+ {
+ // Setup
+ var failureMechanismSectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ // Call
+ failureMechanismSectionResult.AssessmentLayerThree = (RoundedDouble) newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, failureMechanismSectionResult.AssessmentLayerThree,
+ failureMechanismSectionResult.AssessmentLayerThree.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/SectionResults/MacrostabilityOutwardsFailureMechanismSectionResultTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,254 @@
+// 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.ComponentModel;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probability;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.Input;
+using Ringtoets.Integration.Forms.PropertyClasses;
+
+namespace Ringtoets.Integration.Forms.Test.PropertyClasses
+{
+ public class MacroStabilityOutwardsFailureMechanismPropertiesTest
+ {
+ [Test]
+ public void Constructor_DataIsNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new MacroStabilityOutwardsFailureMechanismProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("data", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_ExpectedValues(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant
+ };
+
+ // Call
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreEqual(failureMechanism.Name, properties.Name);
+ Assert.AreEqual(failureMechanism.Code, properties.Code);
+ Assert.AreEqual(isRelevant, properties.IsRelevant);
+
+ MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput;
+ Assert.AreEqual(probabilityAssessmentInput.A, properties.A);
+ Assert.AreEqual(probabilityAssessmentInput.B, properties.B);
+ Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
+ Assert.AreEqual(probabilityAssessmentInput.GetSectionSpecificN(
+ probabilityAssessmentInput.SectionLength),
+ properties.N,
+ properties.N.GetAccuracy());
+ Assert.AreEqual(2, properties.SectionLength.NumberOfDecimalPlaces);
+ Assert.AreEqual(probabilityAssessmentInput.SectionLength,
+ properties.SectionLength,
+ properties.SectionLength.GetAccuracy());
+ }
+
+ [Test]
+ public void Constructor_IsRelevantTrue_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = true
+ };
+
+ // Call
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string lengthEffectCategory = "Lengte-effect parameters";
+
+ PropertyDescriptor nameProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor labelProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor isRelevantProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty,
+ generalCategory,
+ "Is relevant",
+ "Geeft aan of dit toetsspoor relevant is of niet.",
+ true);
+
+ PropertyDescriptor aProperty = dynamicProperties[3];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(aProperty,
+ lengthEffectCategory,
+ "a [-]",
+ "De parameter 'a' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans.");
+
+ PropertyDescriptor bProperty = dynamicProperties[4];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(bProperty,
+ lengthEffectCategory,
+ "b [m]",
+ "De parameter 'b' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans.",
+ true);
+
+ PropertyDescriptor sectionLengthProperty = dynamicProperties[5];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(sectionLengthProperty,
+ lengthEffectCategory,
+ "Lengte* [m]",
+ "Totale lengte van het traject in meters (afgerond).",
+ true);
+
+ PropertyDescriptor nProperty = dynamicProperties[6];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty,
+ lengthEffectCategory,
+ "N* [-]",
+ "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling (afgerond).",
+ true);
+ }
+
+ [Test]
+ public void Constructor_IsRelevantFalse_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = false
+ };
+
+ // Call
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+
+ PropertyDescriptor nameProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor labelProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor isRelevantProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty,
+ generalCategory,
+ "Is relevant",
+ "Geeft aan of dit toetsspoor relevant is of niet.",
+ true);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(-1)]
+ [TestCase(-0.1)]
+ [TestCase(1.1)]
+ [TestCase(8)]
+ public void A_SetInvalidValue_ThrowsArgumentOutOfRangeException(double value)
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Call
+ TestDelegate call = () => properties.A = value;
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("De waarde moet in het bereik [0,0, 1,0] liggen.", exception.Message);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(0.1)]
+ [TestCase(1)]
+ [TestCase(0.0000001)]
+ [TestCase(0.9999999)]
+ public void A_SetValidValue_SetsValue(double value)
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Call
+ properties.A = value;
+
+ // Assert
+ Assert.AreEqual(value, failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DynamicVisibleValidationMethod_DependingOnRelevancy_ReturnExpectedVisibility(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant
+ };
+ var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism);
+
+ // Call & Assert
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Name)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.IsRelevant)));
+
+ Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.A)));
+ Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.B)));
+ Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.SectionLength)));
+ Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.N)));
+
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(null));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAloneFailureMechanismContextPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAloneFailureMechanismPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAloneFailureMechanismPropertiesTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAloneFailureMechanismPropertiesTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,128 @@
+// 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.ComponentModel;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Integration.Forms.PropertyClasses;
+
+namespace Ringtoets.Integration.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class StandAloneFailureMechanismPropertiesTest
+ {
+ [Test]
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new StandAloneFailureMechanismProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("failureMechanism", paramName);
+ }
+
+ [Test]
+ public void Constructor_WithFailureMechanism_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ var properties = new StandAloneFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(failureMechanism, properties.Data);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_WithIsRelevant_ReturnCorrectPropertyValues(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism
+ {
+ IsRelevant = isRelevant
+ };
+
+ // Call
+ var properties = new StandAloneFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ Assert.AreEqual(failureMechanism.Name, properties.Name);
+ Assert.AreEqual(failureMechanism.Code, properties.Code);
+ Assert.AreEqual(isRelevant, properties.IsRelevant);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism
+ {
+ IsRelevant = isRelevant
+ };
+
+ // Call
+ var properties = new StandAloneFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ const string generalCategory = "Algemeen";
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(3, dynamicProperties.Count);
+
+ PropertyDescriptor nameProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor codeProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(codeProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor isRelevantProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty,
+ generalCategory,
+ "Is relevant",
+ "Geeft aan of dit toetsspoor relevant is of niet.",
+ true);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r8c7c25ee0b61c182e38073f56cb6376c511ccbf2 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 8c7c25ee0b61c182e38073f56cb6376c511ccbf2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -37,6 +37,7 @@
+
@@ -53,7 +54,7 @@
-
+
@@ -66,7 +67,7 @@
-
+
@@ -79,7 +80,7 @@
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,120 @@
+// 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 Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.TypeConverters;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Ringtoets.Integration.Forms.Views.SectionResultRows;
+
+namespace Ringtoets.Integration.Forms.Test.Views.SectionResultRows
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsSectionResultRowTest
+ {
+ [Test]
+ public void Constructor_WithParameters_ExpectedValues()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+
+ // Call
+ var row = new MacroStabilityOutwardsSectionResultRow(result);
+
+ // Assert
+ Assert.IsInstanceOf>(row);
+ Assert.AreEqual(result.AssessmentLayerTwoA, row.AssessmentLayerTwoA);
+ Assert.AreEqual(result.AssessmentLayerThree, row.AssessmentLayerThree);
+
+ TestHelper.AssertTypeConverter(
+ nameof(MacroStabilityOutwardsSectionResultRow.AssessmentLayerTwoA));
+ TestHelper.AssertTypeConverter(
+ nameof(MacroStabilityOutwardsSectionResultRow.AssessmentLayerThree));
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1)]
+ [TestCase(0.5)]
+ [TestCase(1e-6)]
+ [TestCase(double.NaN)]
+ public void AssessmentLayerTwoA_ForValidValues_ResultPropertyChanged(double value)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+ var row = new MacroStabilityOutwardsSectionResultRow(result);
+
+ // Call
+ row.AssessmentLayerTwoA = value;
+
+ // Assert
+ Assert.AreEqual(value, row.AssessmentLayerTwoA);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(-20)]
+ [TestCase(-1e-6)]
+ [TestCase(1 + 1e-6)]
+ [TestCase(12)]
+ public void AssessmentLayerTwoA_ForInvalidValues_ThrowsArgumentException(double value)
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+ var row = new MacroStabilityOutwardsSectionResultRow(result);
+
+ // Call
+ TestDelegate test = () => row.AssessmentLayerTwoA = value;
+
+ // Assert
+ string message = Assert.Throws(test).Message;
+ const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen.";
+ Assert.AreEqual(expectedMessage, message);
+ }
+
+ [Test]
+ public void AssessmentLayerThree_AlwaysOnChange_ResultPropertyChanged()
+ {
+ // Setup
+ var random = new Random(21);
+ double newValue = random.NextDouble();
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section);
+ var row = new MacroStabilityOutwardsSectionResultRow(result);
+
+ // Call
+ row.AssessmentLayerThree = (RoundedDouble) newValue;
+
+ // Assert
+ Assert.AreEqual(newValue, result.AssessmentLayerThree, row.AssessmentLayerThree.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacrostabilityOutwardsSectionResultRowTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs
===================================================================
diff -u -r802ea30d1fe8fbae93e58dff9ab054dbabca11ae -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 802ea30d1fe8fbae93e58dff9ab054dbabca11ae)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -35,7 +35,7 @@
namespace Ringtoets.Integration.Forms.Test.Views.SectionResultViews
{
[TestFixture]
- public class MacrostabilityOutwardsResultViewTest
+ public class MacroStabilityOutwardsResultViewTest
{
private const int nameColumnIndex = 0;
private const int assessmentLayerOneIndex = 1;
@@ -47,7 +47,7 @@
{
// Given
using (var form = new Form())
- using (var view = new MacrostabilityOutwardsResultView())
+ using (var view = new MacroStabilityOutwardsResultView())
{
form.Controls.Add(view);
form.Show();
@@ -88,27 +88,27 @@
});
var random = new Random(21);
- var result1 = new MacrostabilityOutwardsFailureMechanismSectionResult(section1)
+ var result1 = new MacroStabilityOutwardsFailureMechanismSectionResult(section1)
{
AssessmentLayerOne = AssessmentLayerOneState.Sufficient,
AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(),
AssessmentLayerThree = (RoundedDouble) random.NextDouble()
};
- var result2 = new MacrostabilityOutwardsFailureMechanismSectionResult(section2)
+ var result2 = new MacroStabilityOutwardsFailureMechanismSectionResult(section2)
{
AssessmentLayerOne = AssessmentLayerOneState.NotAssessed,
AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(),
AssessmentLayerThree = (RoundedDouble) random.NextDouble()
};
- var result3 = new MacrostabilityOutwardsFailureMechanismSectionResult(section3)
+ var result3 = new MacroStabilityOutwardsFailureMechanismSectionResult(section3)
{
AssessmentLayerOne = AssessmentLayerOneState.NoVerdict,
AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(),
AssessmentLayerThree = (RoundedDouble) random.NextDouble()
};
using (var form = new Form())
- using (var view = new MacrostabilityOutwardsResultView())
+ using (var view = new MacroStabilityOutwardsResultView())
{
form.Controls.Add(view);
form.Show();
@@ -173,14 +173,14 @@
new Point2D(0, 0)
});
var random = new Random(21);
- var result = new MacrostabilityOutwardsFailureMechanismSectionResult(section)
+ var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section)
{
AssessmentLayerOne = assessmentLayerOneState,
AssessmentLayerTwoA = (RoundedDouble) random.NextDouble(),
AssessmentLayerThree = (RoundedDouble) random.NextDouble()
};
using (var form = new Form())
- using (var view = new MacrostabilityOutwardsResultView())
+ using (var view = new MacroStabilityOutwardsResultView())
{
form.Controls.Add(view);
form.Show();
@@ -223,7 +223,7 @@
var result2 = new TestFailureMechanismSectionResult(section2);
using (var form = new Form())
- using (var view = new MacrostabilityOutwardsResultView())
+ using (var view = new MacroStabilityOutwardsResultView())
{
form.Controls.Add(view);
form.Show();
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Handlers/ReferenceLineReplacementHandlerTest.cs
===================================================================
diff -u -r5d822eca2d7467c9781a4a3a54d796ac4229e4a3 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Handlers/ReferenceLineReplacementHandlerTest.cs (.../ReferenceLineReplacementHandlerTest.cs) (revision 5d822eca2d7467c9781a4a3a54d796ac4229e4a3)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Handlers/ReferenceLineReplacementHandlerTest.cs (.../ReferenceLineReplacementHandlerTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -252,10 +252,10 @@
CollectionAssert.IsEmpty(macroStabilityInwardsFailureMechanism.SurfaceLines);
CollectionAssert.Contains(observables, macroStabilityInwardsFailureMechanism.SurfaceLines);
- MacrostabilityOutwardsFailureMechanism macrostabilityOutwardsFailureMechanism = assessmentSection.MacrostabilityOutwards;
- CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.Sections);
- CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.SectionResults);
- CollectionAssert.Contains(observables, macrostabilityOutwardsFailureMechanism);
+ MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism = assessmentSection.MacroStabilityOutwards;
+ CollectionAssert.IsEmpty(macroStabilityOutwardsFailureMechanism.Sections);
+ CollectionAssert.IsEmpty(macroStabilityOutwardsFailureMechanism.SectionResults);
+ CollectionAssert.Contains(observables, macroStabilityOutwardsFailureMechanism);
MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability;
CollectionAssert.IsEmpty(microstabilityFailureMechanism.Sections);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,81 @@
+// 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.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Integration.Forms.PropertyClasses;
+
+namespace Ringtoets.Integration.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class StandAloneFailureMechanismPropertyInfoTest
+ {
+ private RingtoetsPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new RingtoetsPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(StandAloneFailureMechanismProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(FailureMechanismContext), info.DataType);
+ Assert.AreEqual(typeof(StandAloneFailureMechanismProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_Always_NewPropertiesWithFailureMechanismAsData()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new FailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(failureMechanism, objectProperties.Data);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rc840995eaf5d4c4564b7edfa56d964ea55ebbec0 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision c840995eaf5d4c4564b7edfa56d964ea55ebbec0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -55,6 +55,7 @@
+
@@ -76,7 +77,7 @@
-
+
@@ -102,7 +103,7 @@
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rf730cc647492866c7c77b96c9e44b0bd4208142c -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision f730cc647492866c7c77b96c9e44b0bd4208142c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -251,7 +251,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(FailureMechanismContext),
- typeof(StandAloneFailureMechanismContextProperties));
+ typeof(StandAloneFailureMechanismProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
@@ -400,9 +400,9 @@
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
- typeof(FailureMechanismSectionResultContext),
- typeof(IEnumerable),
- typeof(MacrostabilityOutwardsResultView));
+ typeof(FailureMechanismSectionResultContext),
+ typeof(IEnumerable),
+ typeof(MacroStabilityOutwardsResultView));
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
@@ -490,7 +490,7 @@
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(Comment)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsProject)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveConditionsInputContext)));
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs
===================================================================
diff -u -rc114776ae9eae9848dd5841211bbe2105ae57dc7 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision c114776ae9eae9848dd5841211bbe2105ae57dc7)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -211,7 +211,7 @@
Assert.AreSame(assessmentSection.MacroStabilityInwards, macroStabilityInwardsFailureMechanismContext.WrappedData);
Assert.AreSame(assessmentSection, macroStabilityInwardsFailureMechanismContext.Parent);
var macrostabilityOutwardsFailureMechanismContext = (FailureMechanismContext) objects[8];
- Assert.AreSame(assessmentSection.MacrostabilityOutwards, macrostabilityOutwardsFailureMechanismContext.WrappedData);
+ Assert.AreSame(assessmentSection.MacroStabilityOutwards, macrostabilityOutwardsFailureMechanismContext.WrappedData);
Assert.AreSame(assessmentSection, macrostabilityOutwardsFailureMechanismContext.Parent);
var microstabilityFailureMechanismContext = (FailureMechanismContext) objects[9];
Assert.AreSame(assessmentSection.Microstability, microstabilityFailureMechanismContext.WrappedData);
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -r6e4bf216d76f52ad3159a6cf1ab3ea38c2f17f28 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision 6e4bf216d76f52ad3159a6cf1ab3ea38c2f17f28)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/FailureMechanismContextTreeNodeInfoTest.cs (.../FailureMechanismContextTreeNodeInfoTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -218,8 +218,8 @@
TestName = "ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult)")]
[TestCase(typeof(WaterPressureAsphaltCoverFailureMechanismSectionResult),
TestName = "ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(WaterPressureAsphaltCoverFailureMechanismSectionResult)")]
- [TestCase(typeof(MacrostabilityOutwardsFailureMechanismSectionResult),
- TestName = "ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(MacrostabilityOutwardsFailureMechanismSectionResult)")]
+ [TestCase(typeof(MacroStabilityOutwardsFailureMechanismSectionResult),
+ TestName = "ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(MacroStabilityOutwardsFailureMechanismSectionResult)")]
public void ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(Type t)
{
// Delegate actual test
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,141 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest
+ {
+ private MockRepository mocks;
+ private RingtoetsPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RingtoetsPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsName()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ var mechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual("Resultaat", text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Setup
+ mocks.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var menuBuilder = mocks.StrictMock();
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocks.Stub();
+ gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+
+ mocks.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+ }
+ // Assert
+ // Assert expectancies are called in TearDown()
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacrostabilityOutwardsFailureMechanismSectionResultContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -0,0 +1,318 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Ringtoets.Integration.Forms.Views.SectionResultViews;
+using Ringtoets.Piping.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsResultViewInfoTest
+ {
+ private MockRepository mocks;
+ private RingtoetsPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RingtoetsPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(MacroStabilityOutwardsResultView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.DataType);
+ Assert.AreEqual(typeof(IEnumerable), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewData_Always_ReturnsWrappedFailureMechanismResult()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism);
+
+ // Call
+ object viewData = info.GetViewData(context);
+
+ // Assert
+ Assert.AreSame(failureMechanism.SectionResults, viewData);
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var view = mocks.StrictMock();
+
+ mocks.ReplayAll();
+
+ // Call
+ string viewName = info.GetViewName(view, failureMechanism.SectionResults);
+
+ // Assert
+ Assert.AreEqual("Resultaat", viewName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ViewType_Always_ReturnsViewType()
+ {
+ // Call
+ Type viewType = info.ViewType;
+
+ // Assert
+ Assert.AreEqual(typeof(MacroStabilityOutwardsResultView), viewType);
+ }
+
+ [Test]
+ public void DataType_Always_ReturnsDataType()
+ {
+ // Call
+ Type dataType = info.DataType;
+
+ // Assert
+ Assert.AreEqual(typeof(FailureMechanismSectionResultContext), dataType);
+ }
+
+ [Test]
+ public void ViewDataType_Always_ReturnsViewDataType()
+ {
+ // Call
+ Type viewDataType = info.ViewDataType;
+
+ // Assert
+ Assert.AreEqual(typeof(IEnumerable), viewDataType);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Call
+ Image image = info.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image);
+ }
+
+ [Test]
+ public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]);
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var otherFailureMechanism = mocks.Stub("N", "C");
+
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ otherFailureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ new PipingFailureMechanism(),
+ failureMechanism
+ });
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue()
+ {
+ // Setup
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, failureMechanism);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, new MacroStabilityOutwardsFailureMechanism());
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanismContext = mocks.StrictMock>();
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ failureMechanismContext.Expect(fm => fm.WrappedData).Return(failureMechanism);
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, failureMechanismContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var failureMechanismContext = mocks.StrictMock>();
+ failureMechanismContext.Expect(fm => fm.WrappedData).Return(new MacroStabilityOutwardsFailureMechanism());
+
+ mocks.ReplayAll();
+
+ using (var view = new MacroStabilityOutwardsResultView())
+ {
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ view.Data = failureMechanism.SectionResults;
+
+ // Call
+ bool closeForData = info.CloseForData(view, failureMechanismContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void AfterCreate_Always_SetsSpecificPropertiesToView()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var view = mocks.StrictMock();
+ var context = new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism);
+
+ view.Expect(v => v.FailureMechanism = failureMechanism);
+
+ mocks.ReplayAll();
+
+ // Call
+ info.AfterCreate(view, context);
+
+ // Assert
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacrostabilityOutwardsResultViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/RingtoetsDataSynchronizationServiceTest.cs
===================================================================
diff -u -r3401d9bb860058fd63172e26815bff00ee84f704 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/RingtoetsDataSynchronizationServiceTest.cs (.../RingtoetsDataSynchronizationServiceTest.cs) (revision 3401d9bb860058fd63172e26815bff00ee84f704)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Service.Test/RingtoetsDataSynchronizationServiceTest.cs (.../RingtoetsDataSynchronizationServiceTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -559,9 +559,9 @@
CollectionAssert.IsEmpty(macroStabilityInwardsFailureMechanism.StochasticSoilModels);
CollectionAssert.IsEmpty(macroStabilityInwardsFailureMechanism.SurfaceLines);
- MacrostabilityOutwardsFailureMechanism macrostabilityOutwardsFailureMechanism = assessmentSection.MacrostabilityOutwards;
- CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.Sections);
- CollectionAssert.IsEmpty(macrostabilityOutwardsFailureMechanism.SectionResults);
+ MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism = assessmentSection.MacroStabilityOutwards;
+ CollectionAssert.IsEmpty(macroStabilityOutwardsFailureMechanism.Sections);
+ CollectionAssert.IsEmpty(macroStabilityOutwardsFailureMechanism.SectionResults);
MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability;
CollectionAssert.IsEmpty(microstabilityFailureMechanism.Sections);
@@ -662,8 +662,8 @@
CollectionAssert.Contains(changedObjects, macroStabilityInwardsFailureMechanism.StochasticSoilModels);
CollectionAssert.Contains(changedObjects, macroStabilityInwardsFailureMechanism.SurfaceLines);
- MacrostabilityOutwardsFailureMechanism macrostabilityOutwardsFailureMechanism = assessmentSection.MacrostabilityOutwards;
- CollectionAssert.Contains(changedObjects, macrostabilityOutwardsFailureMechanism);
+ MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism = assessmentSection.MacroStabilityOutwards;
+ CollectionAssert.Contains(changedObjects, macroStabilityOutwardsFailureMechanism);
MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability;
CollectionAssert.Contains(changedObjects, microstabilityFailureMechanism);
@@ -762,8 +762,8 @@
CollectionAssert.Contains(changedObjects, macroStabilityInwardsFailureMechanism.StochasticSoilModels);
CollectionAssert.Contains(changedObjects, macroStabilityInwardsFailureMechanism.SurfaceLines);
- MacrostabilityOutwardsFailureMechanism macrostabilityOutwardsFailureMechanism = assessmentSection.MacrostabilityOutwards;
- CollectionAssert.Contains(changedObjects, macrostabilityOutwardsFailureMechanism);
+ MacroStabilityOutwardsFailureMechanism macroStabilityOutwardsFailureMechanism = assessmentSection.MacroStabilityOutwards;
+ CollectionAssert.Contains(changedObjects, macroStabilityOutwardsFailureMechanism);
MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability;
CollectionAssert.Contains(changedObjects, microstabilityFailureMechanism);
@@ -1404,7 +1404,7 @@
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.Piping));
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.GrassCoverErosionInwards));
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.MacroStabilityInwards));
- expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.MacrostabilityOutwards));
+ expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.MacroStabilityOutwards));
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.Microstability));
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.StabilityStoneCover));
expectedRemovedObjects.AddRange(GetExpectedRemovedObjectsWhenClearingReferenceLine(assessmentSection.WaveImpactAsphaltCover));
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismTest.cs
===================================================================
diff -u -r42fe292c690bdcccae5c67a15c1bd5ae290627b7 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismTest.cs (.../MacroStabilityInwardsFailureMechanismTest.cs) (revision 42fe292c690bdcccae5c67a15c1bd5ae290627b7)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismTest.cs (.../MacroStabilityInwardsFailureMechanismTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -46,6 +46,7 @@
CollectionAssert.IsEmpty(failureMechanism.Sections);
CollectionAssert.IsEmpty(failureMechanism.SurfaceLines);
CollectionAssert.IsEmpty(failureMechanism.StochasticSoilModels);
+ Assert.IsNotNull(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput);
}
[Test]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs
===================================================================
diff -u -r42fe292c690bdcccae5c67a15c1bd5ae290627b7 -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 42fe292c690bdcccae5c67a15c1bd5ae290627b7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismTest.cs (.../PipingFailureMechanismTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7)
@@ -19,9 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using Core.Common.Base;
using NUnit.Framework;
-using Rhino.Mocks;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
@@ -30,14 +28,6 @@
[TestFixture]
public class PipingFailureMechanismTest
{
- private MockRepository mockRepository;
-
- [SetUp]
- public void SetUp()
- {
- mockRepository = new MockRepository();
- }
-
[Test]
public void DefaultConstructor_ExpectedValues()
{
@@ -51,7 +41,8 @@
Assert.AreEqual("Dijken en dammen - Piping", failureMechanism.Name);
Assert.AreEqual("STPH", failureMechanism.Code);
- Assert.IsInstanceOf(failureMechanism.GeneralInput);
+ Assert.IsNotNull(failureMechanism.GeneralInput);
+ Assert.IsNotNull(failureMechanism.PipingProbabilityAssessmentInput);
Assert.AreEqual("Berekeningen", failureMechanism.CalculationsGroup.Name);
CollectionAssert.IsEmpty(failureMechanism.CalculationsGroup.Children);