Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs
===================================================================
diff -u -rea495159c320abdbbd9fe4e4dd37c98672116c6b -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs (.../MacroStabilityInwardsOutputContext.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs (.../MacroStabilityInwardsOutputContext.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -21,20 +21,50 @@
using System;
using Core.Common.Controls.PresentationObjects;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.MacroStabilityInwards.Data;
namespace Ringtoets.MacroStabilityInwards.Forms.PresentationObjects
{
///
- /// A presentation layer object which wraps a and a .
+ /// A presentation layer object which wraps a .
///
public class MacroStabilityInwardsOutputContext : ObservableWrappedObjectContextBase
{
///
/// Creates a new instance of .
///
/// The wrapped data.
- /// Thrown when is null.
- public MacroStabilityInwardsOutputContext(MacroStabilityInwardsCalculationScenario wrappedData) : base(wrappedData) {}
+ /// The failure mechanism that the calculation belongs to.
+ /// The assessment section that the calculation belongs to.
+ /// Thrown when any parameter is null.
+ public MacroStabilityInwardsOutputContext(MacroStabilityInwardsCalculationScenario wrappedData,
+ MacroStabilityInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ : base(wrappedData)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the failure mechanism.
+ ///
+ public MacroStabilityInwardsFailureMechanism FailureMechanism { get; }
+
+ ///
+ /// Gets the assessment section.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOutputProperties.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOutputProperties.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsOutputProperties.cs (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -0,0 +1,158 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base.Data;
+using Core.Common.Gui.Attributes;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.Util.Attributes;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Forms.Properties;
+
+namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses
+{
+ ///
+ /// ViewModel of for properties panel.
+ ///
+ public class MacroStabilityInwardsOutputProperties : ObjectProperties
+ {
+ private const int macroStabilityInwardsFactorOfStabilityIndex = 1;
+ private const int requiredProbabilityIndex = 2;
+ private const int requiredReliabilityIndex = 3;
+ private const int macroStabilityInwardsProbabilityIndex = 4;
+ private const int macroStabilityInwardsReliabilityIndex = 5;
+ private const int macroStabilityInwardsFactorOfSafetyIndex = 6;
+ private DerivedMacroStabilityInwardsOutput derivedOutput;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The output to show the properties for.
+ /// The failure mechanism the output belongs to.
+ /// The assessment section the output belongs to.
+ /// Thrown when any parameter
+ /// is null.
+ public MacroStabilityInwardsOutputProperties(MacroStabilityInwardsOutput output,
+ MacroStabilityInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ if (output == null)
+ {
+ throw new ArgumentNullException(nameof(output));
+ }
+
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ Data = output;
+ CreateDerivedOutput(output, failureMechanism, assessmentSection);
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_FactorOfStability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_FactorOfStability_Description))]
+ [PropertyOrder(macroStabilityInwardsFactorOfStabilityIndex)]
+ public RoundedDouble MacroStabilityInwardsFactorOfStability
+ {
+ get
+ {
+ return derivedOutput.FactorOfStability;
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_RequiredProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_RequiredProbability_Description))]
+ [PropertyOrder(requiredProbabilityIndex)]
+ public string RequiredProbability
+ {
+ get
+ {
+ return ProbabilityFormattingHelper.Format(derivedOutput.RequiredProbability);
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_RequiredReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_RequiredReliability_Description))]
+ [PropertyOrder(requiredReliabilityIndex)]
+ public RoundedDouble RequiredReliability
+ {
+ get
+ {
+ return derivedOutput.RequiredReliability;
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsProbability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsProbability_Description))]
+ [PropertyOrder(macroStabilityInwardsProbabilityIndex)]
+ public string MacroStabilityInwardsProbability
+ {
+ get
+ {
+ return ProbabilityFormattingHelper.Format(derivedOutput.MacroStabilityInwardsProbability);
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsReliability_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsReliability_Description))]
+ [PropertyOrder(macroStabilityInwardsReliabilityIndex)]
+ public RoundedDouble MacroStabilityInwardsReliability
+ {
+ get
+ {
+ return derivedOutput.MacroStabilityInwardsReliability;
+ }
+ }
+
+ [ResourcesCategory(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_Categories_MacroStabilityInwards))]
+ [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsFactorOfSafety_DisplayName))]
+ [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsSemiProbabilisticOutput_MacroStabilityInwardsFactorOfSafety_Description))]
+ [PropertyOrder(macroStabilityInwardsFactorOfSafetyIndex)]
+ public RoundedDouble MacroStabilityInwardsFactorOfSafety
+ {
+ get
+ {
+ return derivedOutput.MacroStabilityInwardsFactorOfSafety;
+ }
+ }
+
+ private void CreateDerivedOutput(MacroStabilityInwardsOutput output,
+ MacroStabilityInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ derivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(output, failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput,
+ assessmentSection.FailureMechanismContribution.Norm, failureMechanism.Contribution);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 0bc724e93170500800aa7e5d3bf641ab44eeeac7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsSemiProbabilisticOutputProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj
===================================================================
diff -u -r8e062ef408ff5e32cf4545c50960055b69c51586 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 8e062ef408ff5e32cf4545c50960055b69c51586)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -53,7 +53,7 @@
-
+
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs
===================================================================
diff -u -r8e062ef408ff5e32cf4545c50960055b69c51586 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 8e062ef408ff5e32cf4545c50960055b69c51586)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -76,9 +76,9 @@
{
CreateInstance = context => new MacroStabilityInwardsInputContextProperties(context, new ObservablePropertyChangeHandler(context.MacroStabilityInwardsCalculation, context.WrappedData))
};
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = context => new MacroStabilityInwardsSemiProbabilisticOutputProperties(context.WrappedData.SemiProbabilisticOutput)
+ CreateInstance = context => new MacroStabilityInwardsOutputProperties(context.WrappedData.Output, context.FailureMechanism, context.AssessmentSection)
};
yield return new PropertyInfo
{
@@ -756,20 +756,22 @@
.Build();
}
- private static object[] CalculationContextChildNodeObjects(MacroStabilityInwardsCalculationScenarioContext macroStabilityInwardsCalculationScenarioContext)
+ private static object[] CalculationContextChildNodeObjects(MacroStabilityInwardsCalculationScenarioContext context)
{
- MacroStabilityInwardsCalculationScenario macroStabilityInwardsCalculationScenario = macroStabilityInwardsCalculationScenarioContext.WrappedData;
+ MacroStabilityInwardsCalculationScenario macroStabilityInwardsCalculationScenario = context.WrappedData;
return new object[]
{
macroStabilityInwardsCalculationScenario.Comments,
new MacroStabilityInwardsInputContext(macroStabilityInwardsCalculationScenario.InputParameters,
macroStabilityInwardsCalculationScenario,
- macroStabilityInwardsCalculationScenarioContext.AvailableMacroStabilityInwardsSurfaceLines,
- macroStabilityInwardsCalculationScenarioContext.AvailableStochasticSoilModels,
- macroStabilityInwardsCalculationScenarioContext.FailureMechanism,
- macroStabilityInwardsCalculationScenarioContext.AssessmentSection),
- new MacroStabilityInwardsOutputContext(macroStabilityInwardsCalculationScenario)
+ context.AvailableMacroStabilityInwardsSurfaceLines,
+ context.AvailableStochasticSoilModels,
+ context.FailureMechanism,
+ context.AssessmentSection),
+ new MacroStabilityInwardsOutputContext(macroStabilityInwardsCalculationScenario,
+ context.FailureMechanism,
+ context.AssessmentSection)
};
}
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs
===================================================================
diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs (.../MacroStabilityInwardsOutputContextTest.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs (.../MacroStabilityInwardsOutputContextTest.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -19,8 +19,11 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Controls.PresentationObjects;
using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.MacroStabilityInwards.Data;
using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects;
@@ -30,17 +33,59 @@
public class MacroStabilityInwardsOutputContextTest
{
[Test]
- public void Constructor_WithCalculationScenario_PropertiesSet()
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
{
// Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
var calculation = new MacroStabilityInwardsCalculationScenario();
// Call
- var context = new MacroStabilityInwardsOutputContext(calculation);
+ TestDelegate call = () => new MacroStabilityInwardsOutputContext(calculation, null, assessmentSection);
// Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculation = new MacroStabilityInwardsCalculationScenario();
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ // Call
+ TestDelegate call = () => new MacroStabilityInwardsOutputContext(calculation, failureMechanism, null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var calculation = new MacroStabilityInwardsCalculationScenario();
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ // Call
+ var context = new MacroStabilityInwardsOutputContext(calculation, failureMechanism, assessmentSection);
+
+ // Assert
Assert.IsInstanceOf>(context);
Assert.AreSame(calculation, context.WrappedData);
+ Assert.AreSame(failureMechanism, context.FailureMechanism);
+ Assert.AreSame(assessmentSection, context.AssessmentSection);
+ mocks.VerifyAll();
}
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputPropertiesTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputPropertiesTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputPropertiesTest.cs (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -0,0 +1,211 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses;
+
+namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses
+{
+ [TestFixture]
+ public class MacroStabilityInwardsOutputPropertiesTest
+ {
+ [Test]
+ public void Constructor_OutputNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate call = () => new MacroStabilityInwardsOutputProperties(null, new MacroStabilityInwardsFailureMechanism(),
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("output", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ MacroStabilityInwardsOutput output = MacroStabilityInwardsOutputTestFactory.CreateOutput();
+
+ // Call
+ TestDelegate call = () => new MacroStabilityInwardsOutputProperties(output, null,
+ assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ MacroStabilityInwardsOutput output = MacroStabilityInwardsOutputTestFactory.CreateOutput();
+
+ // Call
+ TestDelegate call = () => new MacroStabilityInwardsOutputProperties(output, new MacroStabilityInwardsFailureMechanism(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ MacroStabilityInwardsOutput output = MacroStabilityInwardsOutputTestFactory.CreateOutput();
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ var assessmentSection = new ObservableTestAssessmentSectionStub();
+
+ // Call
+ var properties = new MacroStabilityInwardsOutputProperties(output, failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreSame(output, properties.Data);
+ }
+
+ [Test]
+ public void GetProperties_WithData_ReturnExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism
+ {
+ Contribution = 10,
+ MacroStabilityInwardsProbabilityAssessmentInput =
+ {
+ SectionLength = random.Next(1000)
+ }
+ };
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
+ MacroStabilityInwardsOutput output = MacroStabilityInwardsOutputTestFactory.CreateRandomOutput();
+
+ // Call
+ var properties = new MacroStabilityInwardsOutputProperties(output, failureMechanism, assessmentSection);
+
+ // Assert
+ DerivedMacroStabilityInwardsOutput expectedDerivedOutput = DerivedMacroStabilityInwardsOutputFactory.Create(
+ output,
+ failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput,
+ assessmentSection.FailureMechanismContribution.Norm,
+ failureMechanism.Contribution);
+
+ Assert.AreEqual(expectedDerivedOutput.FactorOfStability, properties.MacroStabilityInwardsFactorOfStability,
+ properties.MacroStabilityInwardsFactorOfStability.GetAccuracy());
+
+ const string probabilityFormat = "1/{0:n0}";
+ Assert.AreEqual(string.Format(probabilityFormat, 1 / expectedDerivedOutput.RequiredProbability), properties.RequiredProbability);
+ Assert.AreEqual(expectedDerivedOutput.RequiredReliability, properties.RequiredReliability, properties.RequiredReliability.GetAccuracy());
+ Assert.AreEqual(string.Format(probabilityFormat, 1 / expectedDerivedOutput.MacroStabilityInwardsProbability), properties.MacroStabilityInwardsProbability);
+ Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsReliability, properties.MacroStabilityInwardsReliability, properties.MacroStabilityInwardsReliability.GetAccuracy());
+ Assert.AreEqual(expectedDerivedOutput.MacroStabilityInwardsFactorOfSafety, properties.MacroStabilityInwardsFactorOfSafety, properties.MacroStabilityInwardsFactorOfSafety.GetAccuracy());
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
+ {
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
+ MacroStabilityInwardsOutput output = MacroStabilityInwardsOutputTestFactory.CreateOutput();
+
+ // Call
+ var properties = new MacroStabilityInwardsOutputProperties(output, failureMechanism, assessmentSection);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(6, dynamicProperties.Count);
+
+ const string macroStabilityInwardsCategory = "Macrostabiliteit binnenwaarts";
+
+ PropertyDescriptor stabilityFactorProperty = dynamicProperties[0];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(stabilityFactorProperty,
+ macroStabilityInwardsCategory,
+ "Stabiliteitsfactor [-]",
+ "Het quotiënt van de weerstandbiedende- en aandrijvende krachten langs een glijvlak.",
+ true);
+
+ PropertyDescriptor requiredProbabilityProperty = dynamicProperties[1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(requiredProbabilityProperty,
+ macroStabilityInwardsCategory,
+ "Faalkanseis [1/jaar]",
+ "De maximaal toegestane kans dat het toetsspoor macrostabiliteit binnenwaarts optreedt.",
+ true);
+
+ PropertyDescriptor requiredReliabilityProperty = dynamicProperties[2];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(requiredReliabilityProperty,
+ macroStabilityInwardsCategory,
+ "Betrouwbaarheidsindex faalkanseis [-]",
+ "De betrouwbaarheidsindex van de faalkanseis voor het toetsspoor macrostabiliteit binnenwaarts.",
+ true);
+
+ PropertyDescriptor macroStabilityInwardsProbabilityProperty = dynamicProperties[3];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(macroStabilityInwardsProbabilityProperty,
+ macroStabilityInwardsCategory,
+ "Benaderde faalkans [1/jaar]",
+ "De benaderde kans dat het toetsspoor macrostabiliteit binnenwaarts optreedt voor deze berekening.",
+ true);
+
+ PropertyDescriptor macroStabilityInwardsReliabilityProperty = dynamicProperties[4];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(macroStabilityInwardsReliabilityProperty,
+ macroStabilityInwardsCategory,
+ "Betrouwbaarheidsindex faalkans [-]",
+ "De betrouwbaarheidsindex van de faalkans voor deze berekening.",
+ true);
+
+ PropertyDescriptor macroStabilityInwardsFactorOfSafetyProperty = dynamicProperties[5];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(macroStabilityInwardsFactorOfSafetyProperty,
+ macroStabilityInwardsCategory,
+ "Veiligheidsfactor [-]",
+ "De veiligheidsfactor voor deze berekening.",
+ true);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 0bc724e93170500800aa7e5d3bf641ab44eeeac7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSemiProbabilisticOutputPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj
===================================================================
diff -u -r8e062ef408ff5e32cf4545c50960055b69c51586 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 8e062ef408ff5e32cf4545c50960055b69c51586)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -41,7 +41,7 @@
-
+
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs
===================================================================
diff -u -r8e062ef408ff5e32cf4545c50960055b69c51586 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision 8e062ef408ff5e32cf4545c50960055b69c51586)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -76,7 +76,7 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
typeof(MacroStabilityInwardsOutputContext),
- typeof(MacroStabilityInwardsSemiProbabilisticOutputProperties));
+ typeof(MacroStabilityInwardsOutputProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
Fisheye: Tag 0bc724e93170500800aa7e5d3bf641ab44eeeac7 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsOutputContextPropertyInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsOutputPropertyInfoTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsOutputPropertyInfoTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsOutputPropertyInfoTest.cs (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -0,0 +1,88 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects;
+using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses;
+
+namespace Ringtoets.MacroStabilityInwards.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class MacroStabilityInwardsOutputPropertyInfoTest
+ {
+ private MacroStabilityInwardsPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new MacroStabilityInwardsPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(MacroStabilityInwardsOutputProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(MacroStabilityInwardsOutputContext), info.DataType);
+ Assert.AreEqual(typeof(MacroStabilityInwardsOutputProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_Always_NewPropertiesWithOutputAsData()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ var mocks = new MockRepository();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
+ };
+
+ var context = new MacroStabilityInwardsOutputContext(scenario, failureMechanism, assessmentSection);
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(scenario.Output, objectProperties.Data);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj
===================================================================
diff -u -r4e9d3556e3cee0365fc0f26d0bad19b50594e12d -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 4e9d3556e3cee0365fc0f26d0bad19b50594e12d)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -46,7 +46,7 @@
-
+
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs
===================================================================
diff -u -rb2f4b307c254c747a5cf01d2fb94970e5e954c36 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs) (revision b2f4b307c254c747a5cf01d2fb94970e5e954c36)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -27,6 +27,8 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.MacroStabilityInwards.Data;
using Ringtoets.MacroStabilityInwards.Data.TestUtil;
using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects;
@@ -124,6 +126,7 @@
// Call
info.ContextMenuStrip(null, null, treeViewControl);
}
+
// Assert
// Assert expectancies are called in TearDown()
}
@@ -132,26 +135,35 @@
public void ForeColor_HasOutputTrue_ReturnControlText()
{
// Setup
- var calculation = new MacroStabilityInwardsCalculationScenario
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+
+ var scenario = new MacroStabilityInwardsCalculationScenario
{
Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
};
+ var context = new MacroStabilityInwardsOutputContext(scenario, failureMechanism, assessmentSection);
// Call
- Color color = info.ForeColor(new MacroStabilityInwardsOutputContext(calculation));
+ Color color = info.ForeColor(context);
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color);
+ mocks.VerifyAll();
}
[Test]
public void ForeColor_HasOutputFalse_ReturnGrayText()
{
// Setup
- var calculation = new MacroStabilityInwardsCalculationScenario();
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ var scenario = new MacroStabilityInwardsCalculationScenario();
+ var context = new MacroStabilityInwardsOutputContext(scenario, failureMechanism, assessmentSection);
+
// Call
- Color color = info.ForeColor(new MacroStabilityInwardsOutputContext(calculation));
+ Color color = info.ForeColor(context);
// Assert
Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewInfoTest.cs
===================================================================
diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r0bc724e93170500800aa7e5d3bf641ab44eeeac7
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewInfoTest.cs (.../MacroStabilityInwardsOutputViewInfoTest.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewInfoTest.cs (.../MacroStabilityInwardsOutputViewInfoTest.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
@@ -25,6 +25,7 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
@@ -89,14 +90,17 @@
public void GetViewData_Always_ReturnsWrappedCalculation()
{
// Setup
- var calculation = new MacroStabilityInwardsCalculationScenario();
- var context = new MacroStabilityInwardsOutputContext(calculation);
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
+ var scenario = new MacroStabilityInwardsCalculationScenario();
+ var context = new MacroStabilityInwardsOutputContext(scenario, failureMechanism, assessmentSection);
+
// Call
object viewData = info.GetViewData(context);
// Assert
- Assert.AreSame(calculation, viewData);
+ Assert.AreSame(scenario, viewData);
mocks.VerifyAll();
}