Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -r1dc153548233c3eac614a9e36691d92b22268140 -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismContextPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismContextPropertiesTest.cs) (revision 1dc153548233c3eac614a9e36691d92b22268140) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismContextPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismContextPropertiesTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -131,13 +131,10 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(16, dynamicProperties.Count); + Assert.AreEqual(5, dynamicProperties.Count); const string generalCategory = "Algemeen"; - const string heaveCategory = "Heave"; - const string modelFactorCategory = "Modelinstellingen"; const string semiProbabilisticCategory = "Semi-probabilistische parameters"; - const string sellmeijerCategory = "Terugschrijdende erosie (Sellmeijer)"; PropertyDescriptor nameProperty = dynamicProperties[0]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, @@ -160,95 +157,19 @@ "Geeft aan of dit toetsspoor relevant is of niet.", true); - PropertyDescriptor volumicWeightOfWaterProperty = dynamicProperties[3]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(volumicWeightOfWaterProperty, - generalCategory, - "Volumiek gewicht van water [kN/m³]", - "Volumiek gewicht van water."); - - PropertyDescriptor upliftModelFactorProperty = dynamicProperties[4]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upliftModelFactorProperty, - modelFactorCategory, - "Modelfactor opbarsten [-]", - "Rekenwaarde om de onzekerheid in het model van opbarsten in rekening te brengen.", - true); - - PropertyDescriptor sellmeijerModelFactorProperty = dynamicProperties[5]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(sellmeijerModelFactorProperty, - modelFactorCategory, - "Modelfactor piping toegepast op het model van Sellmeijer [-]", - "Rekenwaarde om de onzekerheid in het model van Sellmeijer in rekening te brengen.", - true); - - PropertyDescriptor aProperty = dynamicProperties[6]; + PropertyDescriptor aProperty = dynamicProperties[3]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(aProperty, semiProbabilisticCategory, "a [-]", "De parameter 'a' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans."); - PropertyDescriptor bProperty = dynamicProperties[7]; + PropertyDescriptor bProperty = dynamicProperties[4]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(bProperty, semiProbabilisticCategory, "b [m]", "De parameter 'b' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans.", true); - PropertyDescriptor criticalHeaveGradientProperty = dynamicProperties[8]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(criticalHeaveGradientProperty, - heaveCategory, - "Kritiek verhang m.b.t. heave [-]", - "Kritiek verhang met betrekking tot heave.", - true); - - PropertyDescriptor volumetricWeightSandParticlesProperty = dynamicProperties[9]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(volumetricWeightSandParticlesProperty, - sellmeijerCategory, - "Volumiek gewicht van de zandkorrels onder water [kN/m³]", - "Het (ondergedompelde) volumegewicht van zandkorrelmateriaal van een zandlaag.", - true); - - PropertyDescriptor whitesDragCoefficientProperty = dynamicProperties[10]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(whitesDragCoefficientProperty, - sellmeijerCategory, - "Coëfficiënt van White [-]", - "Sleepkrachtfactor volgens White.", - true); - - PropertyDescriptor beddingAngleProperty = dynamicProperties[11]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(beddingAngleProperty, - sellmeijerCategory, - "Rolweerstandshoek [°]", - "Hoek in het krachtenevenwicht die aangeeft hoeveel weerstand de korrels bieden tegen rollen; ook beddingshoek genoemd.", - true); - - PropertyDescriptor waterKinematicViscosityProperty = dynamicProperties[12]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waterKinematicViscosityProperty, - sellmeijerCategory, - "Kinematische viscositeit van water bij 10° C [m²/s]", - "Kinematische viscositeit van water bij 10° C.", - true); - - PropertyDescriptor gravityProperty = dynamicProperties[13]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(gravityProperty, - sellmeijerCategory, - "Valversnelling [m/s²]", - "Valversnelling.", - true); - - PropertyDescriptor meanDiameter70Property = dynamicProperties[14]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(meanDiameter70Property, - sellmeijerCategory, - "Referentiewaarde voor 70%-fraktiel in Sellmeijer regel [m]", - "Gemiddelde d70 van de in kleine schaalproeven toegepaste zandsoorten, waarop de formule van Sellmeijer is gefit.", - true); - - PropertyDescriptor reductionFactorSellmeijerProperty = dynamicProperties[15]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reductionFactorSellmeijerProperty, - sellmeijerCategory, - "Reductiefactor Sellmeijer [-]", - "Reductiefactor Sellmeijer.", - true); - mockRepository.VerifyAll(); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -rfa793614c09a92df2865cfa5be643bead61e5fe1 -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision fa793614c09a92df2865cfa5be643bead61e5fe1) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -53,21 +53,9 @@ private const int expectedSelectedHydraulicBoundaryLocationPropertyIndex = 0; private const int expectedAssessmentLevelPropertyIndex = 1; private const int expectedUseHydraulicBoundaryLocationPropertyIndex = 2; - private const int expectedDampingFactorExitPropertyIndex = 3; - private const int expectedPhreaticLevelExitPropertyIndex = 4; - private const int expectedPiezometricHeadExitPropertyIndex = 5; - private const int expectedSurfaceLinePropertyIndex = 6; - private const int expectedStochasticSoilModelPropertyIndex = 7; - private const int expectedStochasticSoilProfilePropertyIndex = 8; - private const int expectedEntryPointLPropertyIndex = 9; - private const int expectedExitPointLPropertyIndex = 10; - private const int expectedSeepageLengthPropertyIndex = 11; - private const int expectedThicknessCoverageLayerPropertyIndex = 12; - private const int expectedEffectiveThicknessCoverageLayerPropertyIndex = 13; - private const int expectedThicknessAquiferLayerPropertyIndex = 14; - private const int expectedDarcyPermeabilityPropertyIndex = 15; - private const int expectedDiameter70PropertyIndex = 16; - private const int expectedSaturatedVolumicWeightOfCoverageLayerPropertyIndex = 17; + private const int expectedSurfaceLinePropertyIndex = 3; + private const int expectedStochasticSoilModelPropertyIndex = 4; + private const int expectedStochasticSoilProfilePropertyIndex = 5; [Test] public void Constructor_DataNull_ThrowArgumentNullException() @@ -176,7 +164,7 @@ // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - Assert.AreEqual(18, dynamicProperties.Count); + Assert.AreEqual(6, dynamicProperties.Count); const string hydraulicDataCategory = "Hydraulische gegevens"; const string schematizationCategory = "Schematisatie"; @@ -203,32 +191,6 @@ "Handmatig toetspeil invoeren", "Sta toe om het toetspeil handmatig te specificeren?"); - PropertyDescriptor dampingsFactorExitProperty = dynamicProperties[expectedDampingFactorExitPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - dampingsFactorExitProperty, - hydraulicDataCategory, - "Dempingsfactor bij uittredepunt [-]", - "Dempingsfactor relateert respons van stijghoogte bij binnenteen aan buitenwaterstand.", - true); - Assert.IsInstanceOf(dampingsFactorExitProperty.Converter); - - PropertyDescriptor phreaticLevelExitProperty = dynamicProperties[expectedPhreaticLevelExitPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - phreaticLevelExitProperty, - hydraulicDataCategory, - "Polderpeil [m+NAP]", - "Polderpeil.", - true); - Assert.IsInstanceOf(phreaticLevelExitProperty.Converter); - - PropertyDescriptor piezometricHeadExitProperty = dynamicProperties[expectedPiezometricHeadExitPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - piezometricHeadExitProperty, - hydraulicDataCategory, - "Stijghoogte bij uittredepunt [m+NAP]", - "Stijghoogte bij uittredepunt.", - true); - PropertyDescriptor surfaceLineProperty = dynamicProperties[expectedSurfaceLinePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( surfaceLineProperty, @@ -250,137 +212,12 @@ "Ondergrondschematisatie", "De opbouw van de ondergrond."); - PropertyDescriptor seepageLengthProperty = dynamicProperties[expectedSeepageLengthPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - seepageLengthProperty, - schematizationCategory, - "Kwelweglengte [m]", - "De horizontale afstand tussen intrede- en uittredepunt die het kwelwater ondergronds aflegt voordat het weer aan de oppervlakte komt.", - true); - Assert.IsInstanceOf(seepageLengthProperty.Converter); - - PropertyDescriptor thicknessCoverageLayerProperty = dynamicProperties[expectedThicknessCoverageLayerPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - thicknessCoverageLayerProperty, - schematizationCategory, - "Totale deklaagdikte bij uittredepunt [m]", - "Totale deklaagdikte bij uittredepunt.", - true); - Assert.IsInstanceOf(thicknessCoverageLayerProperty.Converter); - - PropertyDescriptor effectiveThicknessCoverageLayerProperty = dynamicProperties[expectedEffectiveThicknessCoverageLayerPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - effectiveThicknessCoverageLayerProperty, - schematizationCategory, - "Effectieve deklaagdikte bij uittredepunt [m]", - "Effectieve deklaagdikte bij uittredepunt.", - true); - Assert.IsInstanceOf(effectiveThicknessCoverageLayerProperty.Converter); - - PropertyDescriptor thicknessAquiferLayerProperty = dynamicProperties[expectedThicknessAquiferLayerPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - thicknessAquiferLayerProperty, - schematizationCategory, - "Dikte watervoerend pakket [m]", - "De dikte van de bovenste voor doorlatendheid te onderscheiden zandlaag of combinatie van zandlagen.", - true); - Assert.IsInstanceOf(thicknessAquiferLayerProperty.Converter); - - PropertyDescriptor darcyPermeabilityProperty = dynamicProperties[expectedDarcyPermeabilityPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - darcyPermeabilityProperty, - schematizationCategory, - "Doorlatendheid aquifer [m/s]", - "Darcy-snelheid waarmee water door de eerste voor doorlatendheid te onderscheiden zandlaag loopt.", - true); - Assert.IsInstanceOf(darcyPermeabilityProperty.Converter); - - PropertyDescriptor diameter70Property = dynamicProperties[expectedDiameter70PropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - diameter70Property, - schematizationCategory, - "De d70 in de bovenste zandlaag [m]", - "Zeefmaat waar 70 gewichtsprocent van de korrels uit een zandlaag doorheen gaat. Hier de korreldiameter van het bovenste gedeelte van de voor doorlatendheid te onderscheiden zandlaag, bepaald zonder fijne fractie (< 63µm).", - true); - Assert.IsInstanceOf(diameter70Property.Converter); - - PropertyDescriptor saturatedVolumicWeightOfCoverageLayerProperty = dynamicProperties[expectedSaturatedVolumicWeightOfCoverageLayerPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - saturatedVolumicWeightOfCoverageLayerProperty, - schematizationCategory, - "Verzadigd gewicht deklaag [kN/m³]", - "Verzadigd gewicht deklaag.", - true); - Assert.IsInstanceOf(saturatedVolumicWeightOfCoverageLayerProperty.Converter); - mocks.VerifyAll(); } - + [Test] [TestCase(true)] [TestCase(false)] - public void Constructor_WithOrWithoutSurfaceLine_EntryAndExitPointPropertyReadOnlyWithoutSurfaceLine(bool withSurfaceLine) - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - mocks.ReplayAll(); - - var calculationItem = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var inputParameters = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput()); - - if (withSurfaceLine) - { - var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine(); - surfaceLine.SetGeometry(new[] - { - new Point3D(0, 0, 0), - new Point3D(2, 0, 2) - }); - inputParameters.SurfaceLine = surfaceLine; - } - - // Call - var context = new MacroStabilityInwardsInputContext(inputParameters, - calculationItem, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); - - var properties = new MacroStabilityInwardsInputContextProperties(context, handler); - - // Assert - PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); - - const string schematizationCategory = "Schematisatie"; - - PropertyDescriptor entryPointLProperty = dynamicProperties[expectedEntryPointLPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - entryPointLProperty, - schematizationCategory, - "Intredepunt", - "De positie in het dwarsprofiel van het intredepunt.", - !withSurfaceLine); - - PropertyDescriptor exitPointLProperty = dynamicProperties[expectedExitPointLPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( - exitPointLProperty, - schematizationCategory, - "Uittredepunt", - "De positie in het dwarsprofiel van het uittredepunt.", - !withSurfaceLine); - - mocks.VerifyAll(); - } - - [Test] - [TestCase(true)] - [TestCase(false)] public void GetProperties_UseAssessmentLevelManualInput_ReturnsExpectedAttributeValues(bool useManualAssessmentLevelInput) { // Setup @@ -414,7 +251,7 @@ const string hydraulicDataCategory = "Hydraulische gegevens"; if (!useManualAssessmentLevelInput) { - Assert.AreEqual(18, dynamicProperties.Count); + Assert.AreEqual(6, dynamicProperties.Count); PropertyDescriptor hydraulicBoundaryLocationProperty = dynamicProperties[expectedSelectedHydraulicBoundaryLocationPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( @@ -433,7 +270,7 @@ } else { - Assert.AreEqual(17, dynamicProperties.Count); + Assert.AreEqual(5, dynamicProperties.Count); PropertyDescriptor assessmentLevelProperty = dynamicProperties[0]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( @@ -622,6 +459,7 @@ calculation); } + [Test] public void HydraulicBoundaryLocation_DesignWaterLevelIsNaN_AssessmentLevelSetToNaN() { // Setup Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs =================================================================== diff -u -r1dfe335d89faf030245030c56c27359b330933ae -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 1dfe335d89faf030245030c56c27359b330933ae) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -128,7 +128,7 @@ }) { // Precondition - Assert.AreEqual(10, view.Chart.Data.Collection.Count()); + Assert.AreEqual(2, view.Chart.Data.Collection.Count()); Assert.AreEqual("Nieuwe berekening", view.Chart.ChartTitle); // Call @@ -211,7 +211,7 @@ Assert.AreSame(calculation, view.Data); ChartDataCollection chartData = view.Chart.Data; Assert.IsInstanceOf(chartData); - Assert.AreEqual(10, chartData.Collection.Count()); + Assert.AreEqual(2, chartData.Collection.Count()); AssertSoilProfileChartData(stochasticSoilProfile, chartData.Collection.ElementAt(soilProfileIndex), true); AssertSurfaceLineChartData(surfaceLine, chartData.Collection.ElementAt(surfaceLineIndex)); } @@ -255,7 +255,7 @@ Assert.AreSame(calculation, view.Data); ChartDataCollection chartData = view.Chart.Data; Assert.IsInstanceOf(chartData); - Assert.AreEqual(10, chartData.Collection.Count()); + Assert.AreEqual(2, chartData.Collection.Count()); var soilProfileData = (ChartDataCollection) chartData.Collection.ElementAt(soilProfileIndex); CollectionAssert.IsEmpty(soilProfileData.Collection); Assert.AreEqual("Ondergrondschematisatie", soilProfileData.Name); @@ -285,7 +285,7 @@ Assert.AreSame(calculation, view.Data); ChartDataCollection chartData = view.Chart.Data; Assert.IsInstanceOf(chartData); - Assert.AreEqual(10, chartData.Collection.Count()); + Assert.AreEqual(2, chartData.Collection.Count()); var soilProfileData = (ChartDataCollection) chartData.Collection.ElementAt(soilProfileIndex); CollectionAssert.IsEmpty(soilProfileData.Collection); Assert.AreEqual("Ondergrondschematisatie", soilProfileData.Name); @@ -401,7 +401,7 @@ // Setup var mocks = new MockRepository(); var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()).Repeat.Times(9); + observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); using (var view = new MacroStabilityInwardsInputView()) @@ -505,7 +505,7 @@ { ChartDataCollection chartData = view.Chart.Data; - ChartData dataToMove = chartData.Collection.ElementAt(surfaceLineIndex); + ChartData dataToMove = chartData.Collection.ElementAt(soilProfileIndex); chartData.Remove(dataToMove); chartData.Add(dataToMove); @@ -601,7 +601,7 @@ // Precondition Assert.IsNotNull(chartData); - Assert.AreEqual(10, chartData.Collection.Count()); + Assert.AreEqual(2, chartData.Collection.Count()); AssertSoilProfileChartData(stochasticSoilProfile, chartData.Collection.ElementAt(soilProfileIndex), true); // When @@ -673,7 +673,7 @@ List chartDatasList = chartDataCollection.Collection.ToList(); - Assert.AreEqual(10, chartDatasList.Count); + Assert.AreEqual(2, chartDatasList.Count); var soilProfileData = (ChartDataCollection) chartDatasList[soilProfileIndex]; var surfaceLineData = (ChartLineData) chartDatasList[surfaceLineIndex]; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs =================================================================== diff -u -r0b9d576cd70a004dc6efd3578b723b0a3b505b76 -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs (.../MacroStabilityInwardsScenariosViewTest.cs) (revision 0b9d576cd70a004dc6efd3578b723b0a3b505b76) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs (.../MacroStabilityInwardsScenariosViewTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -47,9 +47,6 @@ private const int contributionColumnIndex = 1; private const int nameColumnIndex = 2; private const int failureProbabilityColumnIndex = 3; - private const int failureProbabilityUpliftColumnIndex = 4; - private const int failureProbabilityHeaveColumnIndex = 5; - private const int failureProbabilitySellmeijerColumnIndex = 6; private Form testForm; [SetUp] @@ -220,24 +217,18 @@ Assert.AreEqual(2, rows.Count); DataGridViewCellCollection cells = rows[0].Cells; - Assert.AreEqual(7, cells.Count); + Assert.AreEqual(4, cells.Count); Assert.IsTrue(Convert.ToBoolean(cells[isRelevantColumnIndex].FormattedValue)); Assert.AreEqual(100.ToString(CultureInfo.CurrentCulture), cells[contributionColumnIndex].FormattedValue); Assert.AreEqual("Calculation 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual("-", cells[failureProbabilityColumnIndex].FormattedValue); - Assert.AreEqual("-".ToString(CultureInfo.CurrentCulture), cells[failureProbabilityUpliftColumnIndex].FormattedValue); - Assert.AreEqual("-".ToString(CultureInfo.CurrentCulture), cells[failureProbabilityHeaveColumnIndex].FormattedValue); - Assert.AreEqual("-".ToString(CultureInfo.CurrentCulture), cells[failureProbabilitySellmeijerColumnIndex].FormattedValue); cells = rows[1].Cells; - Assert.AreEqual(7, cells.Count); + Assert.AreEqual(4, cells.Count); Assert.IsTrue(Convert.ToBoolean(cells[isRelevantColumnIndex].FormattedValue)); Assert.AreEqual(100.ToString(CultureInfo.CurrentCulture), cells[contributionColumnIndex].FormattedValue); Assert.AreEqual("Calculation 2", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(1.5e-3), cells[failureProbabilityColumnIndex].FormattedValue); - Assert.AreEqual(ProbabilityFormattingHelper.Format(double.NaN), cells[failureProbabilityUpliftColumnIndex].FormattedValue); - Assert.AreEqual(ProbabilityFormattingHelper.Format(0.0005), cells[failureProbabilityHeaveColumnIndex].FormattedValue); - Assert.AreEqual(ProbabilityFormattingHelper.Format(1.5e-3), cells[failureProbabilitySellmeijerColumnIndex].FormattedValue); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Readers/MacroStabilityInwardsCalculationConfigurationReaderTest.cs =================================================================== diff -u -r8c921d554a413b322018325cee4b281de4793d9e -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Readers/MacroStabilityInwardsCalculationConfigurationReaderTest.cs (.../MacroStabilityInwardsCalculationConfigurationReaderTest.cs) (revision 8c921d554a413b322018325cee4b281de4793d9e) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Readers/MacroStabilityInwardsCalculationConfigurationReaderTest.cs (.../MacroStabilityInwardsCalculationConfigurationReaderTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -48,48 +48,6 @@ yield return new TestCaseData("invalidAssessmentLevelNoDouble.xml", "The 'toetspeil' element is invalid - The value 'string' is invalid according to its datatype 'Double'") .SetName("invalidAssessmentLevelNoDouble"); - yield return new TestCaseData("invalidEntryPointEmpty.xml", - "The 'intredepunt' element is invalid - The value '' is invalid according to its datatype 'Double'") - .SetName("invalidEntryPointEmpty"); - yield return new TestCaseData("invalidEntryPointNoDouble.xml", - "The 'intredepunt' element is invalid - The value 'string' is invalid according to its datatype 'Double'") - .SetName("invalidEntryPointNoDouble"); - yield return new TestCaseData("invalidExitPointEmpty.xml", - "The 'uittredepunt' element is invalid - The value '' is invalid according to its datatype 'Double'") - .SetName("invalidExitPointEmpty"); - yield return new TestCaseData("invalidExitPointNoDouble.xml", - "The 'uittredepunt' element is invalid - The value 'string' is invalid according to its datatype 'Double'") - .SetName("invalidExitPointNoDouble"); - yield return new TestCaseData("invalidStochastNoName.xml", - "The required attribute 'naam' is missing.") - .SetName("invalidStochastNoName"); - yield return new TestCaseData("invalidStochastUnknownName.xml", - "The 'naam' attribute is invalid - The value 'Test' is invalid according to its datatype 'nameType' - The Enumeration constraint failed.") - .SetName("invalidStochastUnknownName"); - yield return new TestCaseData("invalidStochastMultipleMean.xml", - "Element 'verwachtingswaarde' cannot appear more than once if content model type is \"all\".") - .SetName("invalidStochastMultipleMean"); - yield return new TestCaseData("invalidStochastMultipleStandardDeviation.xml", - "Element 'standaardafwijking' cannot appear more than once if content model type is \"all\".") - .SetName("invalidStochastMultipleStandardDeviation"); - yield return new TestCaseData("invalidStochastMeanEmpty.xml", - "The 'verwachtingswaarde' element is invalid - The value '' is invalid according to its datatype 'Double'") - .SetName("invalidStochastMeanEmpty"); - yield return new TestCaseData("invalidStochastMeanNoDouble.xml", - "The 'verwachtingswaarde' element is invalid - The value 'string' is invalid according to its datatype 'Double'") - .SetName("invalidStochastMeanNoDouble"); - yield return new TestCaseData("invalidStochastStandardDeviationEmpty.xml", - "The 'standaardafwijking' element is invalid - The value '' is invalid according to its datatype 'Double'") - .SetName("invalidStochastStandardDeviationEmpty"); - yield return new TestCaseData("invalidStochastStandardDeviationNoDouble.xml", - "The 'standaardafwijking' element is invalid - The value 'string' is invalid according to its datatype 'Double'") - .SetName("invalidStochastStandardDeviationNoDouble"); - yield return new TestCaseData("invalidMultiplePhreaticLevelExitStochast.xml", - "There is a duplicate key sequence 'polderpeil' for the 'uniqueStochastNameConstraint' key or unique identity constraint.") - .SetName("invalidMultiplePhreaticLevelExitStochast"); - yield return new TestCaseData("invalidMultipleDampingFactorExitStochast.xml", - "There is a duplicate key sequence 'dempingsfactor' for the 'uniqueStochastNameConstraint' key or unique identity constraint.") - .SetName("invalidMultipleDampingFactorExitStochast"); yield return new TestCaseData("invalidContainingBothAssessmentLevelAndHydraulicBoundaryLocation.xml", "Element 'hrlocatie' cannot appear more than once if content model type is \"all\".") .SetName("invalidContainingBothAssessmentLevelAndHydraulicBoundaryLocation"); @@ -102,21 +60,12 @@ yield return new TestCaseData("invalidCalculationMultipleSurfaceLine.xml", "Element 'profielschematisatie' cannot appear more than once if content model type is \"all\".") .SetName("invalidCalculationMultipleSurfaceLine"); - yield return new TestCaseData("invalidCalculationMultipleEntryPoint.xml", - "Element 'intredepunt' cannot appear more than once if content model type is \"all\".") - .SetName("invalidCalculationMultipleEntryPoint"); - yield return new TestCaseData("invalidCalculationMultipleExitPoint.xml", - "Element 'uittredepunt' cannot appear more than once if content model type is \"all\".") - .SetName("invalidCalculationMultipleExitPoint"); - yield return new TestCaseData("invalidCalculationMultipleStochasticSoilModel.xml", + yield return new TestCaseData("invalidCalculationMultipleStochasticSoilModel.xml", "Element 'ondergrondmodel' cannot appear more than once if content model type is \"all\".") .SetName("invalidCalculationMultipleStochasticSoilModel"); yield return new TestCaseData("invalidCalculationMultipleStochasticSoilProfile.xml", "Element 'ondergrondschematisatie' cannot appear more than once if content model type is \"all\".") .SetName("invalidCalculationMultipleStochasticSoilProfile"); - yield return new TestCaseData("invalidCalculationMultipleStochasts.xml", - "Element 'stochasten' cannot appear more than once if content model type is \"all\".") - .SetName("invalidCalculationMultipleStochasts"); yield return new TestCaseData("invalidConfigurationCalculationContainingEmptyHydraulicBoundaryLocation.xml", "The 'hrlocatie' element is invalid - The value '' is invalid according to its datatype 'String' - The actual length is less than the MinLength value.") .SetName("invalidConfigurationCalculationContainingEmptyHydraulicBoundaryLocation"); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/test-data/MacroStabilityInwardsCalculationConfigurationWriter/folderWithSubfolderAndCalculation.xml =================================================================== diff -u -r8c921d554a413b322018325cee4b281de4793d9e -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/test-data/MacroStabilityInwardsCalculationConfigurationWriter/folderWithSubfolderAndCalculation.xml (.../folderWithSubfolderAndCalculation.xml) (revision 8c921d554a413b322018325cee4b281de4793d9e) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/test-data/MacroStabilityInwardsCalculationConfigurationWriter/folderWithSubfolderAndCalculation.xml (.../folderWithSubfolderAndCalculation.xml) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -5,7 +5,7 @@ PUNT_KAT_18 PK001_0001 PK001_0001_Piping - W1-6_0_1D1W1-6_0_1D1 Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsSurfaceLinesCsvImporterTest.cs =================================================================== diff -u -r1dc153548233c3eac614a9e36691d92b22268140 -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsSurfaceLinesCsvImporterTest.cs (.../MacroStabilityInwardsSurfaceLinesCsvImporterTest.cs) (revision 1dc153548233c3eac614a9e36691d92b22268140) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsSurfaceLinesCsvImporterTest.cs (.../MacroStabilityInwardsSurfaceLinesCsvImporterTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -49,7 +49,7 @@ { private const string surfaceLineFormat = "{0}.csv"; private readonly string ioTestDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.MacroStabilityInwards.IO, "SurfaceLines"); - private readonly string pluginSurfaceLinesTestDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.MacroStabilityInwards.Plugin, "SurfaceLines"); + private readonly string pluginTestDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.MacroStabilityInwards.Plugin, "SurfaceLines"); private MockRepository mocks; @@ -191,7 +191,6 @@ var callCount = 0; var progressStarted = false; - var progressCharacteristicPointsStarted = false; var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, validFilePath, messageProvider, surfaceLineUpdateStrategy); @@ -203,12 +202,6 @@ Assert.AreEqual("Inlezen van het profielschematisatiesbestand.", currentStepName); return; } - if (!progressCharacteristicPointsStarted && callCount == expectedNumberOfSurfaceLines + 1) - { - progressCharacteristicPointsStarted = true; - Assert.AreEqual("Inlezen van het karakteristieke punten-bestand.", currentStepName); - return; - } if (callCount <= expectedNumberOfSurfaceLines) { @@ -298,7 +291,7 @@ validFilePath), }; - TestHelper.AssertLogMessagesAreGenerated(call, mesages, 4); + TestHelper.AssertLogMessagesAreGenerated(call, mesages, 3); RingtoetsMacroStabilityInwardsSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy); // Sample some of the imported data: @@ -365,7 +358,8 @@ messageProvider.Expect(mp => mp.GetCancelledLogMessageText("Profielschematisaties")).Return(cancelledLogMessage); mocks.ReplayAll(); - string validFilePath = Path.Combine(ioTestDataPath, "TwoValidSurfaceLines.csv"); + const string fileName = "TwoValidSurfaceLines.csv"; + string validFilePath = Path.Combine(pluginTestDataPath, fileName); var referenceLine = new ReferenceLine(); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); @@ -374,7 +368,7 @@ var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, validFilePath, messageProvider, surfaceLineUpdateStrategy); importer.SetProgressChanged((description, step, steps) => { - if (description.Contains("Inlezen van het karakteristieke punten-bestand.")) + if (description.Contains($"Inlezen '{fileName}'")) { importer.Cancel(); } @@ -391,7 +385,7 @@ // Assert Tuple expectedLogMessage = Tuple.Create(cancelledLogMessage, LogLevelConstant.Info); - TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 4); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 3); AssertUnsuccessfulImport(importResult, surfaceLineUpdateStrategy); } @@ -438,7 +432,7 @@ // Assert Tuple expectedLogMessage = Tuple.Create(cancelledLogMessage, LogLevelConstant.Info); - TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 4); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessage, 3); AssertUnsuccessfulImport(importResult, surfaceLineUpdateStrategy); } @@ -486,7 +480,7 @@ // Assert const string expectedMessage = "Huidige actie was niet meer te annuleren en is daarom voortgezet."; Tuple expectedLogMessageAndLogLevel = Tuple.Create(expectedMessage, LogLevelConstant.Warn); - TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessageAndLogLevel, 4); + TestHelper.AssertLogMessageWithLevelIsGenerated(call, expectedLogMessageAndLogLevel, 3); AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validFilePath, surfaceLineUpdateStrategy); } @@ -723,7 +717,7 @@ mocks.ReplayAll(); const string fileName = "TwoValidSurfaceLines_DuplicateIdentifier"; - string corruptPath = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName)); + string corruptPath = Path.Combine(pluginTestDataPath, string.Format(surfaceLineFormat, fileName)); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] @@ -753,7 +747,7 @@ Tuple.Create(duplicateDefinitionMessage, LogLevelConstant.Warn), }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 4); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 3); RingtoetsMacroStabilityInwardsSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 1, corruptPath, surfaceLineUpdateStrategy); Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1")); @@ -804,13 +798,13 @@ Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_ParseErrorMessage_0_SurfaceLine_skipped, internalErrorMessage), LogLevelConstant.Error), }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 4); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 3); RingtoetsMacroStabilityInwardsSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, corruptPath, surfaceLineUpdateStrategy); Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1")); Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal")); - Assert.AreEqual(10, progressCallCount, + Assert.AreEqual(9, progressCallCount, new StringBuilder() .AppendLine("Expected number of calls:") .AppendLine("1 : Start reading surface lines file.") @@ -861,7 +855,7 @@ Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_ParseErrorMessage_0_SurfaceLine_skipped, internalErrorMessage), LogLevelConstant.Error), }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 4); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 3); AssertSuccessfulImport(importResult, 0, path, surfaceLineUpdateStrategy); Assert.IsTrue(TestHelper.CanOpenFileForWrite(path)); @@ -904,296 +898,13 @@ Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_ParseErrorMessage_0_SurfaceLine_skipped, internalErrorMessage), LogLevelConstant.Error), }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 4); + TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 3); AssertSuccessfulImport(importResult, 0, path, surfaceLineUpdateStrategy); Assert.IsTrue(TestHelper.CanOpenFileForWrite(path)); } [Test] - public void Import_FileWithTwoValidLinesAndOneInvalidCharacteristicPointsDefinitionDueToUnparsableNumber_SkipInvalidRowAndLog() - { - // Setup - var messageProvider = mocks.Stub(); - mocks.ReplayAll(); - - const string fileName = "TwoValidSurfaceLines_WithOneInvalidCharacteristicPoints"; - string surfaceLinesFile = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName)); - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new[] - { - new Point2D(3.3, -1), - new Point2D(3.3, 1), - new Point2D(94270, 427775.65), - new Point2D(94270, 427812.08) - }); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var progressCallCount = 0; - var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); - var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, surfaceLinesFile, messageProvider, surfaceLineUpdateStrategy); - importer.SetProgressChanged((name, step, steps) => progressCallCount++); - - var importResult = false; - - // Call - Action call = () => importResult = importer.Import(); - - // Assert - string internalErrorMessage = new FileReaderErrorMessageBuilder(surfaceLinesFile) - .WithLocation("op regel 2") - .WithSubject("locatie 'Rotterdam1Invalid'") - .Build(IOResources.Error_CharacteristicPoint_has_not_double); - var expectedLogMessagesAndLevel = new[] - { - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_, - surfaceLinesFile), LogLevelConstant.Info), - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_, - surfaceLinesFile), LogLevelConstant.Info) - }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 6); - - RingtoetsMacroStabilityInwardsSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesFile, surfaceLineUpdateStrategy); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1Invalid")); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal")); - - Assert.AreEqual(12, progressCallCount, - new StringBuilder() - .AppendLine("Expected number of calls:") - .AppendLine("1 : Start reading surface lines file.") - .AppendLine("3 : 1 call for each read surface line, +1 for index 0.") - .AppendLine("1 : Start reading characteristic points file.") - .AppendLine("3 : 1 call for each set of characteristic points for a locations being read, +1 for index 0.") - .AppendLine("1 : 1 call to process the imported surface lines.") - .AppendLine("1 : Start adding data to failure mechanism.") - .AppendLine("2 : 1 call for each surfaceline checked against reference line.") - .AppendLine("-- +") - .AppendLine("12") - .ToString()); - } - - [Test] - public void Import_FileWithTwoValidLinesAndOneCharacteristicPointsDefinition_LogMissingDefinition() - { - // Setup - var messageProvider = mocks.Stub(); - mocks.ReplayAll(); - - const string fileName = "TwoValidSurfaceLines_WithOneCharacteristicPointsLocation"; - string surfaceLinesPath = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName)); - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new[] - { - new Point2D(3.3, -1), - new Point2D(3.3, 1), - new Point2D(94270, 427775.65), - new Point2D(94270, 427812.08) - }); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var progressCallCount = 0; - var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); - var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, surfaceLinesPath, messageProvider, surfaceLineUpdateStrategy); - importer.SetProgressChanged((name, step, steps) => progressCallCount++); - - var importResult = false; - - // Call - Action call = () => importResult = importer.Import(); - - // Assert - var expectedLogMessagesAndLevel = new[] - { - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_, - surfaceLinesPath), LogLevelConstant.Info), - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_, - surfaceLinesPath), LogLevelConstant.Info) - }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 5); - - RingtoetsMacroStabilityInwardsSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1")); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal")); - - Assert.AreEqual(11, progressCallCount, - new StringBuilder() - .AppendLine("Expected number of calls:") - .AppendLine("1 : Start reading surface lines file.") - .AppendLine("3 : 1 call for each read surface line, +1 for index 0.") - .AppendLine("1 : Start reading characteristic points file.") - .AppendLine("2 : 1 call for each set of characteristic points for a locations being read, +1 for index 0.") - .AppendLine("1 : 1 call to process the imported surface lines.") - .AppendLine("1 : Start adding data to failure mechanism.") - .AppendLine("2 : 1 call for each surfaceline checked against reference line.") - .AppendLine("-- +") - .AppendLine("11") - .ToString()); - } - - [Test] - public void Import_FileWithTwoValidLinesAndThreeCharacteristicPointsDefinition_LogMissingDefinition() - { - // Setup - var messageProvider = mocks.Stub(); - mocks.ReplayAll(); - - const string fileName = "TwoValidSurfaceLines_WithThreeCharacteristicPointsLocations"; - string surfaceLinesPath = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName)); - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new[] - { - new Point2D(3.3, -1), - new Point2D(3.3, 1), - new Point2D(94270, 427775.65), - new Point2D(94270, 427812.08) - }); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var progressCallCount = 0; - var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); - var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, surfaceLinesPath, messageProvider, surfaceLineUpdateStrategy); - importer.SetProgressChanged((name, step, steps) => progressCallCount++); - - var importResult = false; - - // Call - Action call = () => importResult = importer.Import(); - - // Assert - var expectedLogMessagesAndLevel = new[] - { - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_, - surfaceLinesPath), LogLevelConstant.Info), - Tuple.Create(string.Format(PluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_, - surfaceLinesPath), LogLevelConstant.Info) - }; - TestHelper.AssertLogMessagesWithLevelAreGenerated(call, expectedLogMessagesAndLevel, 5); - - RingtoetsMacroStabilityInwardsSurfaceLine[] importedSurfaceLines = AssertSuccessfulImport(importResult, 2, surfaceLinesPath, surfaceLineUpdateStrategy); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "Rotterdam1")); - Assert.AreEqual(1, importedSurfaceLines.Count(sl => sl.Name == "ArtifcialLocal")); - - Assert.AreEqual(13, progressCallCount, - new StringBuilder() - .AppendLine("Expected number of calls:") - .AppendLine("1 : Start reading surface lines file.") - .AppendLine("3 : 1 call for each read surface line, +1 for index 0.") - .AppendLine("1 : Start reading characteristic points file.") - .AppendLine("4 : 1 call for each set of characteristic points for a locations being read, +1 for index 0.") - .AppendLine("1 : 1 call to process the imported surface lines.") - .AppendLine("1 : Start adding data to failure mechanism.") - .AppendLine("2 : 1 call for each surfaceline checked against reference line.") - .AppendLine("-- +") - .AppendLine("13") - .ToString()); - } - - [Test] - public void Import_ImportingToValidTargetWithValidFileWithCharacteristicPoints_ImportSurfaceLinesToCollection() - { - // Setup - const string expectedAddDataToModelProgressText = "Adding data"; - var messageProvider = mocks.StrictMock(); - messageProvider.Expect(mp => mp.GetAddDataToModelProgressText()).Return(expectedAddDataToModelProgressText); - mocks.ReplayAll(); - - const int expectedNumberOfSurfaceLines = 2; - const int expectedNumberOfCharacteristicPointsDefinitions = 2; - - const string fileName = "TwoValidSurfaceLines_WithCharacteristicPoints"; - string twovalidsurfacelinesCsv = string.Format(surfaceLineFormat, fileName); - - string validSurfaceLinesFilePath = Path.Combine(pluginSurfaceLinesTestDataPath, twovalidsurfacelinesCsv); - string validCharacteristicPointsFilePath = Path.Combine(pluginSurfaceLinesTestDataPath, twovalidsurfacelinesCsv); - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new[] - { - new Point2D(3.3, -1), - new Point2D(3.3, 1), - new Point2D(94270, 427775.65), - new Point2D(94270, 427812.08) - }); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var callCount = 0; - var progressStarted = false; - var progressCharacteristicPointsStarted = false; - - var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); - var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, validSurfaceLinesFilePath, messageProvider, surfaceLineUpdateStrategy); - importer.SetProgressChanged(delegate(string currentStepName, int currentStep, int totalNumberOfSteps) - { - if (!progressStarted && callCount == 0) - { - progressStarted = true; - Assert.AreEqual("Inlezen van het profielschematisatiesbestand.", currentStepName); - return; - } - if (!progressCharacteristicPointsStarted && callCount == expectedNumberOfSurfaceLines + 1) - { - progressCharacteristicPointsStarted = true; - Assert.AreEqual("Inlezen van het karakteristieke punten-bestand.", currentStepName); - return; - } - - if (callCount <= expectedNumberOfSurfaceLines) - { - Assert.AreEqual($"Inlezen '{twovalidsurfacelinesCsv}'", currentStepName); - } - else if (callCount <= expectedNumberOfSurfaceLines + expectedNumberOfCharacteristicPointsDefinitions + 2 + expectedNumberOfSurfaceLines) - { - Assert.AreEqual("Valideren van ingelezen data.", currentStepName); - Assert.AreEqual(expectedNumberOfSurfaceLines, totalNumberOfSteps); - } - else if (callCount <= expectedNumberOfSurfaceLines + expectedNumberOfCharacteristicPointsDefinitions + 2 + expectedNumberOfSurfaceLines + 1) - { - Assert.AreEqual(expectedAddDataToModelProgressText, currentStepName); - } - else - { - Assert.Fail("Not expecting progress: \"{0}: {1} out of {2}\".", currentStepName, currentStep, totalNumberOfSteps); - } - - callCount++; - }); - - // Precondition - CollectionAssert.IsEmpty(failureMechanism.SurfaceLines); - Assert.IsTrue(File.Exists(validSurfaceLinesFilePath)); - Assert.IsTrue(File.Exists(validCharacteristicPointsFilePath)); - - // Call - bool importResult = importer.Import(); - - // Assert - RingtoetsMacroStabilityInwardsSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, expectedNumberOfSurfaceLines, validSurfaceLinesFilePath, surfaceLineUpdateStrategy); - - // Sample some of the imported data: - RingtoetsMacroStabilityInwardsSurfaceLine firstSurfaceLine = importTargetArray[0]; - Assert.AreEqual("Rotterdam1", firstSurfaceLine.Name); - Assert.AreEqual(8, firstSurfaceLine.Points.Length); - Assert.AreEqual(427776.654093, firstSurfaceLine.StartingWorldPoint.Y); - - RingtoetsMacroStabilityInwardsSurfaceLine secondSurfaceLine = importTargetArray[1]; - Assert.AreEqual("ArtifcialLocal", secondSurfaceLine.Name); - Assert.AreEqual(3, secondSurfaceLine.Points.Length); - Assert.AreEqual(5.7, secondSurfaceLine.EndingWorldPoint.X); - - Assert.AreEqual(10, callCount); - - Assert.IsTrue(TestHelper.CanOpenFileForWrite(validSurfaceLinesFilePath)); - Assert.IsTrue(TestHelper.CanOpenFileForWrite(validCharacteristicPointsFilePath)); - } - - [Test] public void Import_DoesNotInterSectReferenceLine_SkipRowAndLog() { // Setup @@ -1292,47 +1003,6 @@ } [Test] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidDikeToeAtRiverAndDikeToeAtPolder")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsDikeToeAtRiverAndDikeToeAtPolderSame")] - public void Import_ExitPointGreaterOrEqualToEntryPoint_SkipRowAndLog(string fileName) - { - // Setup - var messageProvider = mocks.Stub(); - mocks.ReplayAll(); - - string validFilePath = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName)); - - var referenceLine = new ReferenceLine(); - referenceLine.SetGeometry(new[] - { - new Point2D(3.3, -1), - new Point2D(3.3, 1), - new Point2D(94270, 427775.65), - new Point2D(94270, 427812.08) - }); - - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - var surfaceLineUpdateStrategy = new TestSurfaceLineUpdateStrategy(); - var importer = new MacroStabilityInwardsSurfaceLinesCsvImporter(failureMechanism.SurfaceLines, referenceLine, validFilePath, messageProvider, surfaceLineUpdateStrategy); - - // Precondition - CollectionAssert.IsEmpty(failureMechanism.SurfaceLines); - Assert.IsTrue(File.Exists(validFilePath)); - - // Call - bool importResult = importer.Import(); - - // Assert - RingtoetsMacroStabilityInwardsSurfaceLine[] importTargetArray = AssertSuccessfulImport(importResult, 1, validFilePath, surfaceLineUpdateStrategy); - - // Sample some of the imported data: - RingtoetsMacroStabilityInwardsSurfaceLine firstSurfaceLine = importTargetArray[0]; - Assert.AreEqual("Rotterdam1", firstSurfaceLine.Name); - Assert.AreEqual(8, firstSurfaceLine.Points.Length); - Assert.AreEqual(427776.654093, firstSurfaceLine.StartingWorldPoint.Y); - } - - [Test] public void Import_UpdateSurfaceLinesWithImportedDataThrowsUpdateDataException_ReturnFalseAndLogError() { // Setup @@ -1381,9 +1051,9 @@ var messageProvider = mocks.Stub(); mocks.ReplayAll(); - const string fileName = "TwoValidSurfaceLines_WithCharacteristicPoints"; + const string fileName = "TwoValidSurfaceLines"; string twovalidsurfacelinesCsv = string.Format(surfaceLineFormat, fileName); - string validSurfaceLinesFilePath = Path.Combine(pluginSurfaceLinesTestDataPath, twovalidsurfacelinesCsv); + string validSurfaceLinesFilePath = Path.Combine(pluginTestDataPath, twovalidsurfacelinesCsv); var referenceLine = new ReferenceLine(); referenceLine.SetGeometry(new[] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r1dfe335d89faf030245030c56c27359b330933ae -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 1dfe335d89faf030245030c56c27359b330933ae) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -298,10 +298,10 @@ { menu.Items[2], menu.Items[5], - menu.Items[8], - menu.Items[11], - menu.Items[14], - menu.Items[17] + menu.Items[7], + menu.Items[10], + menu.Items[13], + menu.Items[16] }, typeof(ToolStripSeparator)); } } @@ -391,16 +391,16 @@ "Wis de uitvoer van alle berekeningen binnen deze berekeningsmap.", RingtoetsCommonFormsResources.ClearIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExpandAllIndexRootGroup, - "Alles ui&tklappen", - "Klap dit element en alle onderliggende elementen uit.", - CoreCommonGuiResources.ExpandAllIcon, - false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCollapseAllIndexRootGroup, "Alles i&nklappen", "Klap dit element en alle onderliggende elementen in.", CoreCommonGuiResources.CollapseAllIcon, false); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExpandAllIndexRootGroup, + "Alles ui&tklappen", + "Klap dit element en alle onderliggende elementen uit.", + CoreCommonGuiResources.ExpandAllIcon, + false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuPropertiesIndexRootGroup, "Ei&genschappen", @@ -410,12 +410,12 @@ CollectionAssert.AllItemsAreInstancesOfType(new[] { menu.Items[1], + menu.Items[4], menu.Items[6], menu.Items[9], - menu.Items[11], - menu.Items[14], - menu.Items[17], - menu.Items[20] + menu.Items[12], + menu.Items[15], + menu.Items[18] }, typeof(ToolStripSeparator)); } } @@ -813,11 +813,11 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(9, msgs.Length); + Assert.AreEqual(7, msgs.Length); StringAssert.StartsWith($"Validatie van '{validCalculation.Name}' gestart om: ", msgs[0]); StringAssert.StartsWith($"Validatie van '{validCalculation.Name}' beëindigd om: ", msgs[1]); StringAssert.StartsWith($"Validatie van '{invalidCalculation.Name}' gestart om: ", msgs[2]); - StringAssert.StartsWith($"Validatie van '{invalidCalculation.Name}' beëindigd om: ", msgs[8]); + StringAssert.StartsWith($"Validatie van '{invalidCalculation.Name}' beëindigd om: ", msgs[6]); }); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest.cs =================================================================== diff -u -r1dfe335d89faf030245030c56c27359b330933ae -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest.cs) (revision 1dfe335d89faf030245030c56c27359b330933ae) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -53,12 +53,10 @@ [TestFixture] public class MacroStabilityInwardsCalculationScenarioContextTreeNodeInfoTest : NUnitFormTest { - private const int contextMenuUpdateEntryAndExitPointIndex = 3; + private const int contextMenuValidateIndex = 4; + private const int contextMenuCalculateIndex = 5; + private const int contextMenuClearIndex = 7; - private const int contextMenuValidateIndex = 5; - private const int contextMenuCalculateIndex = 6; - private const int contextMenuClearIndex = 8; - private MockRepository mocks; private MacroStabilityInwardsPlugin plugin; private TreeNodeInfo info; @@ -393,136 +391,6 @@ } [Test] - public void ContextMenuStrip_CalculationWithoutSurfaceLine_ContextMenuItemUpdateEntryAndExitPointDisabledAndToolTipSet() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()); - var failureMechanism = new TestMacroStabilityInwardsFailureMechanism(); - var assessmentSection = mocks.Stub(); - var nodeData = new MacroStabilityInwardsCalculationScenarioContext(calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - contextMenuUpdateEntryAndExitPointIndex, - "&Bijwerken intrede- en uittredepunt...", - "Er moet een profielschematisatie geselecteerd zijn.", - RingtoetsCommonFormsResources.UpdateItemIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_CalculationWithSurfaceLineAndInputInSync_ContextMenuItemUpdateEntryAndExitPointDisabledAndToolTipSet() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine(); - surfaceLine.SetGeometry(new[] - { - new Point3D(1, 2, 3), - new Point3D(4, 5, 6) - }); - var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) - { - InputParameters = - { - SurfaceLine = surfaceLine - } - }; - var failureMechanism = new TestMacroStabilityInwardsFailureMechanism(); - var assessmentSection = mocks.Stub(); - var nodeData = new MacroStabilityInwardsCalculationScenarioContext(calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - contextMenuUpdateEntryAndExitPointIndex, - "&Bijwerken intrede- en uittredepunt...", - "Er zijn geen wijzigingen om bij te werken.", - RingtoetsCommonFormsResources.UpdateItemIcon, - false); - } - } - } - - [Test] - public void ContextMenuStrip_CalculationWithSurfaceLineAndInputOutOfSync_ContextMenuItemUpdateEntryAndExitPointEnabledAndToolTipSet() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine(); - surfaceLine.SetGeometry(new[] - { - new Point3D(1, 2, 3), - new Point3D(4, 5, 6) - }); - var calculation = new MacroStabilityInwardsCalculationScenario(new GeneralMacroStabilityInwardsInput()) - { - InputParameters = - { - SurfaceLine = surfaceLine - } - }; - var failureMechanism = new TestMacroStabilityInwardsFailureMechanism(); - var assessmentSection = mocks.Stub(); - var nodeData = new MacroStabilityInwardsCalculationScenarioContext(calculation, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); - mocks.ReplayAll(); - - plugin.Gui = gui; - - ChangeSurfaceLine(surfaceLine); - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, - contextMenuUpdateEntryAndExitPointIndex, - "&Bijwerken intrede- en uittredepunt...", - "Berekening bijwerken met de karakteristieke punten.", - RingtoetsCommonFormsResources.UpdateItemIcon); - } - } - } - - [Test] [TestCase(true)] [TestCase(false)] public void OnNodeRemoved_ParentIsMacroStabilityInwardsCalculationGroupContext_RemoveCalculationFromGroup(bool groupNameEditable) @@ -666,7 +534,7 @@ Action action = () => contextMenuStrip.Items[contextMenuCalculateIndex].PerformClick(); // Then - const int expectedValidationMessageCount = 5; + const int expectedValidationMessageCount = 3; TestHelper.AssertLogMessages(action, messages => { IEnumerator msgs = messages.GetEnumerator(); @@ -720,7 +588,7 @@ Action action = () => contextMenuStrip.Items[contextMenuValidateIndex].PerformClick(); // Then - const int expectedValidationMessageCount = 5; + const int expectedValidationMessageCount = 3; const int expectedStatusMessageCount = 2; const int expectedLogMessageCount = expectedValidationMessageCount + expectedStatusMessageCount; TestHelper.AssertLogMessagesCount(action, expectedLogMessageCount); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r980449901d9470be8933a1cc8f8cb3a874b710df -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 980449901d9470be8933a1cc8f8cb3a874b710df) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -679,11 +679,11 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(9, msgs.Length); - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", validCalculation.Name), msgs[0]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", validCalculation.Name), msgs[1]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", invalidCalculation.Name), msgs[2]); - StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", invalidCalculation.Name), msgs[8]); + Assert.AreEqual(7, msgs.Length); + StringAssert.StartsWith($"Validatie van '{validCalculation.Name}' gestart om: ", msgs[0]); + StringAssert.StartsWith($"Validatie van '{validCalculation.Name}' beëindigd om: ", msgs[1]); + StringAssert.StartsWith($"Validatie van '{invalidCalculation.Name}' gestart om: ", msgs[2]); + StringAssert.StartsWith($"Validatie van '{invalidCalculation.Name}' beëindigd om: ", msgs[6]); }); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/test-data/SurfaceLines/TwoValidSurfaceLines.csv =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/test-data/SurfaceLines/TwoValidSurfaceLines.csv (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/test-data/SurfaceLines/TwoValidSurfaceLines.csv (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -0,0 +1,3 @@ +Profielnaam;X1;Y1;Z1;...;Xn;Yn;Zn;;;;;;;;;;;;;;;;; +Rotterdam1;94263.0026213;427776.654093;-1.02;94275.9126686;427811.080886;-1.04;94284.0663827;427831.918156;1.25;94294.9380015;427858.191234;1.45;94305.3566362;427889.900123;1.65;94315.0957947;427913.908281;1.66;94325.0614453;427941.766804;1.55;94331.1767309;427960.112661;1.44 +ArtifcialLocal;2.3;0;1.0;4.4;0;2.0;5.7;0;1.1;;;;;;;;;;;;;;; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationActivityTest.cs =================================================================== diff -u -r0eabd047acd8eead1728b1153e8a2db5bed4a1ba -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationActivityTest.cs (.../MacroStabilityInwardsCalculationActivityTest.cs) (revision 0eabd047acd8eead1728b1153e8a2db5bed4a1ba) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationActivityTest.cs (.../MacroStabilityInwardsCalculationActivityTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -96,13 +96,11 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(7, msgs.Length); + Assert.AreEqual(5, msgs.Length); StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", invalidMacroStabilityInwardsCalculation.Name), msgs.First()); StringAssert.StartsWith("Validatie mislukt: ", msgs[1]); StringAssert.StartsWith("Validatie mislukt: ", msgs[2]); StringAssert.StartsWith("Validatie mislukt: ", msgs[3]); - StringAssert.StartsWith("Validatie mislukt: ", msgs[4]); - StringAssert.StartsWith("Validatie mislukt: ", msgs[5]); StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", invalidMacroStabilityInwardsCalculation.Name), msgs.Last()); }); Assert.AreEqual(ActivityState.Failed, activity.State); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -re6a1bc79179f9eef940dd6aef2fa6246ffdec176 -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision e6a1bc79179f9eef940dd6aef2fa6246ffdec176) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -37,7 +37,6 @@ [TestFixture] public class MacroStabilityInwardsCalculationServiceTest { - private const string averagingSoilLayerPropertiesMessage = "Meerdere aaneengesloten deklagen gevonden. De grondeigenschappen worden bepaald door het nemen van een gewogen gemiddelde, mits de standaardafwijkingen en verschuivingen voor alle lagen gelijk zijn."; private double testSurfaceLineTopLevel; private MacroStabilityInwardsCalculationScenario testCalculation; @@ -114,13 +113,11 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(7, msgs.Length); + Assert.AreEqual(5, msgs.Length); StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); Assert.AreEqual("Validatie mislukt: Er is geen hydraulische randvoorwaardenlocatie geselecteerd.", msgs[1]); Assert.AreEqual("Validatie mislukt: Er is geen profielschematisatie geselecteerd.", msgs[2]); Assert.AreEqual("Validatie mislukt: Er is geen ondergrondschematisatie geselecteerd.", msgs[3]); - Assert.AreEqual("Validatie mislukt: De waarde voor 'uittredepunt' moet een concreet getal zijn.", msgs[4]); - Assert.AreEqual("Validatie mislukt: De waarde voor 'intredepunt' moet een concreet getal zijn.", msgs[5]); StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); }); Assert.IsFalse(isValid); @@ -144,10 +141,9 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); + Assert.AreEqual(3, msgs.Length); StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); Assert.AreEqual("Validatie mislukt: Kan het toetspeil niet afleiden op basis van de invoer.", msgs[1]); - Assert.AreEqual("Validatie mislukt: Kan de stijghoogte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); }); Assert.IsFalse(isValid); @@ -174,10 +170,9 @@ TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); + Assert.AreEqual(3, msgs.Length); StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); Assert.AreEqual("Validatie mislukt: De waarde voor 'toetspeil' moet een concreet getal zijn.", msgs[1]); - Assert.AreEqual("Validatie mislukt: Kan de stijghoogte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); }); Assert.IsFalse(isValid); @@ -209,41 +204,6 @@ } [Test] - public void Validate_WithSurfaceLineOneOutOfFourDitchPoints_LogsErrorAndReturnsFalse() - { - // Setup - const string name = ""; - - Point3D[] geometry = testCalculation.InputParameters.SurfaceLine.Points; - const string surfaceLineName = "surfaceLineA"; - var surfaceLineMissingCharacteristicPoint = new RingtoetsMacroStabilityInwardsSurfaceLine - { - Name = surfaceLineName - }; - surfaceLineMissingCharacteristicPoint.SetGeometry(geometry); - - testCalculation.InputParameters.SurfaceLine = surfaceLineMissingCharacteristicPoint; - testCalculation.Name = name; - - // Call - var isValid = false; - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - - string expected = $"Validatie mislukt: De sloot in de hoogtegeometrie {surfaceLineName} is niet correct. Niet alle 4 punten zijn gedefinieerd of de volgorde is incorrect."; - Assert.AreEqual(expected, msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] public void Validate_WithoutStochasticSoilProfile_LogsErrorAndReturnsFalse() { // Setup @@ -270,595 +230,6 @@ } [Test] - public void Validate_StochasticSoilProfileBelowSurfaceLine_LogsErrorAndReturnsFalse() - { - // Setup - const string name = ""; - - var topLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel - 1e-6) - { - IsAquifer = false, - BelowPhreaticLevelMean = 15, - BelowPhreaticLevelDeviation = 2, - BelowPhreaticLevelShift = 0 - }; - var bottomLayer = new MacroStabilityInwardsSoilLayer(2.0) - { - IsAquifer = true, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1 - }; - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = new MacroStabilityInwardsSoilProfile( - string.Empty, 0.0, - new[] - { - topLayer, - bottomLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Validatie mislukt: Hoogtegeometrie ligt (deels) boven de ondergrondschematisatie.", msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] - public void Validate_WithoutAquiferLayer_LogsErrorAndReturnsFalse() - { - // Setup - const string name = ""; - - var aquitardLayer = new MacroStabilityInwardsSoilLayer(2.0) - { - IsAquifer = false - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - aquitardLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(6, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Geen deklaag gevonden voor de ondergrondschematisatie onder de profielschematisatie bij het uittredepunt.", msgs[1]); - Assert.AreEqual("Kan de totale deklaagdikte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); - Assert.AreEqual("Validatie mislukt: Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.", msgs[3]); - Assert.AreEqual("Validatie mislukt: Geen watervoerende laag gevonden voor de ondergrondschematisatie onder de profielschematisatie bij het uittredepunt.", msgs[4]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] - public void Validate_WithoutAquitardLayer_LogsWarningsAndReturnsTrue() - { - // Setup - const string name = ""; - - var aquiferLayer = new MacroStabilityInwardsSoilLayer(10.56) - { - IsAquifer = true, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1 - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - aquiferLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Geen deklaag gevonden voor de ondergrondschematisatie onder de profielschematisatie bij het uittredepunt.", msgs[1]); - Assert.AreEqual("Kan de totale deklaagdikte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsTrue(isValid); - } - - [Test] - public void Validate_WithoutCoverageLayer_LogsWarningsAndReturnsTrue() - { - // Setup - const string name = ""; - - var coverageLayerAboveSurfaceLine = new MacroStabilityInwardsSoilLayer(13.0) - { - IsAquifer = false - }; - var bottomAquiferLayer = new MacroStabilityInwardsSoilLayer(11.0) - { - IsAquifer = true, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1 - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - coverageLayerAboveSurfaceLine, - bottomAquiferLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Geen deklaag gevonden voor de ondergrondschematisatie onder de profielschematisatie bij het uittredepunt.", msgs[1]); - Assert.AreEqual("Kan de totale deklaagdikte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsTrue(isValid); - } - - [Test] - public void Validate_MultipleCoverageLayer_LogsWarningAndReturnsTrue() - { - // Setup - const string name = ""; - - var random = new Random(21); - const double belowPhreaticLevelDeviation = 0.5; - const int belowPhreaticLevelShift = 1; - const double belowPhreaticLevelMeanBase = 15.0; - - var topCoverageLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelDeviation = belowPhreaticLevelDeviation, - BelowPhreaticLevelShift = belowPhreaticLevelShift, - BelowPhreaticLevelMean = belowPhreaticLevelMeanBase + belowPhreaticLevelShift + random.NextDouble() - }; - var middleCoverageLayer = new MacroStabilityInwardsSoilLayer(8.5) - { - IsAquifer = false, - BelowPhreaticLevelDeviation = belowPhreaticLevelDeviation, - BelowPhreaticLevelShift = belowPhreaticLevelShift, - BelowPhreaticLevelMean = belowPhreaticLevelMeanBase + belowPhreaticLevelShift + random.NextDouble() - }; - var bottomAquiferLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4 - }; - - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - topCoverageLayer, - middleCoverageLayer, - bottomAquiferLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual(averagingSoilLayerPropertiesMessage, msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsTrue(isValid); - } - - [Test] - [TestCase(false, false)] - [TestCase(false, true)] - [TestCase(true, false)] - public void Validate_IncompleteDiameterD70Definition_LogsErrorAndReturnsFalse(bool meanSet, bool deviationSet) - { - // Setup - const string name = ""; - - var random = new Random(21); - var incompleteSoilLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1 - }; - if (meanSet) - { - incompleteSoilLayer.DiameterD70Mean = 0.1 + random.NextDouble(); - } - if (deviationSet) - { - incompleteSoilLayer.DiameterD70CoefficientOfVariation = random.NextDouble(); - } - - var completeLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 5.0), - BelowPhreaticLevelMean = random.GetFromRange(15.0, 999.999), - BelowPhreaticLevelShift = random.GetFromRange(1e-6, 10.0) - }; - - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - completeLayer, - incompleteSoilLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Validatie mislukt: Kan de definitie voor het 70%-fraktiel van de korreldiameter van de watervoerende laag niet (volledig) afleiden.", msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] - [TestCase(6.2e-5)] - [TestCase(5.1e-3)] - public void Validate_InvalidDiameterD70Value_LogsWarningAndReturnsTrue(double diameter70Value) - { - // Setup - const string name = ""; - - var random = new Random(21); - var coverageLayerInvalidD70 = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1, - DiameterD70Mean = diameter70Value, - DiameterD70CoefficientOfVariation = 0 - }; - var validLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 5.0), - BelowPhreaticLevelMean = random.GetFromRange(15.0, 999.999), - BelowPhreaticLevelShift = random.GetFromRange(1e-6, 10.0) - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - validLayer, - coverageLayerInvalidD70 - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.Name = name; - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual($"Rekenwaarde voor d70 ({new RoundedDouble(6, diameter70Value)} m) ligt buiten het geldigheidsbereik van dit model. Geldige waarden liggen tussen 0.000063 m en 0.0005 m.", msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsTrue(isValid); - } - - [Test] - [TestCase(false, false)] - [TestCase(false, true)] - [TestCase(true, false)] - public void Validate_IncompletePermeabilityDefinition_LogsErrorAndReturnsFalse(bool meanSet, bool deviationSet) - { - // Setup - const string name = ""; - - var random = new Random(21); - var incompleteSoilLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4 - }; - if (meanSet) - { - incompleteSoilLayer.PermeabilityMean = 0.1 + random.NextDouble(); - } - if (deviationSet) - { - incompleteSoilLayer.PermeabilityCoefficientOfVariation = random.NextDouble(); - } - - var completeLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 999.999), - BelowPhreaticLevelMean = random.GetFromRange(10.0, 999.999), - BelowPhreaticLevelShift = random.GetFromRange(1e-6, 10.0) - }; - - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - completeLayer, - incompleteSoilLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Validatie mislukt: Kan de definitie voor de doorlatendheid van de watervoerende laag niet (volledig) afleiden.", msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] - [TestCase(false, false, false)] - [TestCase(false, true, true)] - [TestCase(true, false, true)] - [TestCase(true, true, false)] - public void Validate_IncompleteSaturatedVolumicWeightDefinition_LogsErrorAndReturnsFalse(bool meanSet, bool deviationSet, bool shiftSet) - { - // Setup - const string name = ""; - - var random = new Random(21); - var incompleteSoilLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false - }; - if (deviationSet) - { - incompleteSoilLayer.BelowPhreaticLevelDeviation = random.NextDouble(); - } - if (shiftSet) - { - incompleteSoilLayer.BelowPhreaticLevelShift = random.NextDouble(); - } - if (meanSet) - { - incompleteSoilLayer.BelowPhreaticLevelMean = 0.1 + incompleteSoilLayer.BelowPhreaticLevelShift + random.NextDouble(); - } - - var completeLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1, - DiameterD70CoefficientOfVariation = 0, - DiameterD70Mean = 1e-4 - }; - - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - incompleteSoilLayer, - completeLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - testCalculation.Name = name; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual("Validatie mislukt: Kan de definitie voor het verzadigd gewicht van de deklaag niet (volledig) afleiden.", msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - Assert.IsFalse(isValid); - } - - [Test] - public void Validate_SaturatedCoverageLayerVolumicWeightLessThanWaterVolumicWeight_LogsErrorAndReturnsFalse() - { - // Setup - const string name = ""; - - var coverageLayerInvalidSaturatedVolumicWeight = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelMean = 9.81, - BelowPhreaticLevelDeviation = 2, - BelowPhreaticLevelShift = 0 - }; - var validLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.5, - PermeabilityMean = 1, - DiameterD70Mean = 0.0002, - DiameterD70CoefficientOfVariation = 0 - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - coverageLayerInvalidSaturatedVolumicWeight, - validLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.Name = name; - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - - var isValid = false; - - // Call - Action call = () => isValid = MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(3, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual( - "Validatie mislukt: Het verzadigd volumetrisch gewicht van de deklaag moet groter zijn dan het volumetrisch gewicht van water.", - msgs[1]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - - Assert.IsFalse(isValid); - } - - [Test] - public void Validate_SaturatedCoverageLayerLessThanWaterLayerAndMissingSaturatedParameter_LogsErrorOnlyForIncompleteDefinition() - { - // Setup - const string name = ""; - - var topCoverageLayer = new MacroStabilityInwardsSoilLayer(testSurfaceLineTopLevel) - { - IsAquifer = false, - BelowPhreaticLevelMean = 5, - BelowPhreaticLevelDeviation = 2, - BelowPhreaticLevelShift = 0 - }; - var middleCoverageLayerMissingParameter = new MacroStabilityInwardsSoilLayer(8.5) - { - IsAquifer = false, - BelowPhreaticLevelMean = 5, - BelowPhreaticLevelDeviation = 2, - BelowPhreaticLevelShift = double.NaN - }; - var bottomAquiferLayer = new MacroStabilityInwardsSoilLayer(5.0) - { - IsAquifer = true, - PermeabilityCoefficientOfVariation = 0.3, - PermeabilityMean = 0.6, - DiameterD70Mean = 0.0002, - DiameterD70CoefficientOfVariation = 0 - }; - var profile = new MacroStabilityInwardsSoilProfile(string.Empty, 0.0, - new[] - { - topCoverageLayer, - middleCoverageLayerMissingParameter, - bottomAquiferLayer - }, - SoilProfileType.SoilProfile1D, -1); - - testCalculation.Name = name; - testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - - // Call - Action call = () => MacroStabilityInwardsCalculationService.Validate(testCalculation); - - // Assert - TestHelper.AssertLogMessages(call, messages => - { - string[] msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); - StringAssert.StartsWith($"Validatie van '{name}' gestart om: ", msgs.First()); - Assert.AreEqual(averagingSoilLayerPropertiesMessage, msgs[1]); - Assert.AreEqual( - "Validatie mislukt: Kan de definitie voor het verzadigd gewicht van de deklaag niet (volledig) afleiden.", - msgs[2]); - StringAssert.StartsWith($"Validatie van '{name}' beëindigd om: ", msgs.Last()); - }); - } - - [Test] public void Calculate_CalculationNull_ThrowArgumentNullException() { // Call Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsSemiProbabilisticCalculationServiceTest.cs =================================================================== diff -u -r7521c3b508adaf62efcd6ea3094d315bf100aa3f -r564c43756c2ef4a8d6faa43d4513b59c145045eb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsSemiProbabilisticCalculationServiceTest.cs (.../MacroStabilityInwardsSemiProbabilisticCalculationServiceTest.cs) (revision 7521c3b508adaf62efcd6ea3094d315bf100aa3f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsSemiProbabilisticCalculationServiceTest.cs (.../MacroStabilityInwardsSemiProbabilisticCalculationServiceTest.cs) (revision 564c43756c2ef4a8d6faa43d4513b59c145045eb) @@ -32,21 +32,25 @@ public class MacroStabilityInwardsSemiProbabilisticCalculationServiceTest { [Test] - [TestCase(30000, 4.332647923)] - [TestCase(30000, 5.264767065)] - [TestCase(30000, 4.786155161)] - [TestCase(20000, 4.275544655)] - [TestCase(20000, 5.203962658)] - [TestCase(20000, 4.673091832)] - public void MacroStabilityInwardsReliability_DifferentInputs_ReturnsExpectedValue(int returnPeriod, double expectedResult) + [TestCase(30000, 4.914770, 6000, 12)] + [TestCase(30000, 4.777170, 6000, 24)] + [TestCase(30000, 4.965370, 8000, 12)] + [TestCase(20000, 4.747730, 8000, 24)] + [TestCase(20000, 4.764340, 4000, 12)] + [TestCase(20000, 4.622610, 4000, 24)] + public void MacroStabilityInwardsReliability_DifferentInputs_ReturnsExpectedValue(int returnPeriod, double expectedResult, double assessmentSectionLength, double contribution) { // Setup var calculatorResult = new MacroStabilityInwardsOutput(); + var probabilityAssessmentInput = new MacroStabilityInwardsProbabilityAssessmentInput + { + SectionLength = assessmentSectionLength + }; MacroStabilityInwardsCalculation calculation = AsMacroStabilityInwardsCalculation(calculatorResult); double norm = 1.0 / returnPeriod; - MacroStabilityInwardsSemiProbabilisticCalculationService.Calculate(calculation, new MacroStabilityInwardsProbabilityAssessmentInput(), norm, double.NaN); + MacroStabilityInwardsSemiProbabilisticCalculationService.Calculate(calculation, probabilityAssessmentInput, norm, contribution); // Call RoundedDouble result = calculation.SemiProbabilisticOutput.MacroStabilityInwardsReliability; @@ -86,7 +90,7 @@ const int returnPeriod = 30000; const double assessmentSectionLength = 6000; const double contribution = 24; - const double expectedResult = 0.907; + const double expectedResult = 1; var calculatorResult = new MacroStabilityInwardsOutput(); var probabilityAssessmentInput = new MacroStabilityInwardsProbabilityAssessmentInput @@ -131,21 +135,6 @@ Assert.AreEqual(calculation.SemiProbabilisticOutput.MacroStabilityInwardsReliability / calculation.SemiProbabilisticOutput.RequiredReliability, result, accuracy); } - [Test] - public void Calculate_MissingOutput_ThrowsArgumentException() - { - // Setup - var generalInput = new GeneralMacroStabilityInwardsInput(); - var calculation = new MacroStabilityInwardsCalculation(generalInput); - - // Call - TestDelegate test = () => MacroStabilityInwardsSemiProbabilisticCalculationService.Calculate(calculation, new MacroStabilityInwardsProbabilityAssessmentInput(), int.MinValue, double.NaN); - - // Assert - const string expectedMessage = "Veiligheidsfactor voor piping kan niet worden berekend."; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - private static MacroStabilityInwardsCalculation AsMacroStabilityInwardsCalculation(MacroStabilityInwardsOutput macroStabilityInwardsOutput) { return new MacroStabilityInwardsCalculation(new GeneralMacroStabilityInwardsInput())