Index: Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs
===================================================================
diff -u
--- Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs (revision 0)
+++ Riskeer/Integration/src/Riskeer.Integration.Forms/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathProperties.cs (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
@@ -0,0 +1,189 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+using Core.Common.Base.Data;
+using Core.Common.Util.Attributes;
+using Core.Gui.Attributes;
+using Core.Gui.PropertyBag;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Contribution;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.Properties;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
+
+namespace Riskeer.Integration.Forms.PropertyClasses.StandAlone
+{
+ ///
+ /// Failure path related ViewModel of for properties panel.
+ ///
+ public class StrengthStabilityLengthwiseConstructionFailurePathProperties : ObjectProperties
+ {
+ private const int namePropertyIndex = 1;
+ private const int codePropertyIndex = 2;
+ private const int groupPropertyIndex = 3;
+ private const int contributionPropertyIndex = 4;
+ private const int inAssemblyPropertyIndex = 5;
+ private const int nPropertyIndex = 6;
+ private const int applyLengthEffectInSectionPropertyIndex = 7;
+
+ private readonly IAssessmentSection assessmentSection;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The failure mechanism to show the properties for.
+ /// The assessment section the failure mechanism belongs to.
+ /// Thrown when any parameter is null.
+ public StrengthStabilityLengthwiseConstructionFailurePathProperties(IHasGeneralInput failureMechanism, IAssessmentSection assessmentSection)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ this.assessmentSection = assessmentSection;
+
+ Data = failureMechanism;
+ }
+
+ [DynamicVisibleValidationMethod]
+ public bool DynamicVisibleValidationMethod(string propertyName)
+ {
+ return data.InAssembly || !ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(propertyName);
+ }
+
+ private static bool ShouldHidePropertyWhenFailureMechanismNotPartOfAssembly(string propertyName)
+ {
+ return nameof(Contribution).Equals(propertyName)
+ || nameof(N).Equals(propertyName)
+ || nameof(ApplyLengthEffectInSection).Equals(propertyName);
+ }
+
+ #region Length effect parameters
+
+ [DynamicVisible]
+ [PropertyOrder(nPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_N_Description))]
+ public RoundedDouble N
+ {
+ get
+ {
+ return data.GeneralInput.N;
+ }
+ set
+ {
+ data.GeneralInput.N = value;
+ data.NotifyObservers();
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(applyLengthEffectInSectionPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_LengthEffect))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Apply_LengthEffect_In_Section_Description))]
+ public bool ApplyLengthEffectInSection
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ #endregion
+
+ #region General
+
+ [PropertyOrder(namePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Name_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Name_Description))]
+ public string Name
+ {
+ get
+ {
+ return data.Name;
+ }
+ }
+
+ [PropertyOrder(codePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Code_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailureMechanism_Code_Description))]
+ public string Code
+ {
+ get
+ {
+ return data.Code;
+ }
+ }
+
+ [PropertyOrder(groupPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Group_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Group_Description))]
+ public int Group
+ {
+ get
+ {
+ return data.Group;
+ }
+ }
+
+ [DynamicVisible]
+ [PropertyOrder(contributionPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Contribution_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_Contribution_Description))]
+ public string Contribution
+ {
+ get
+ {
+ return string.Format(Resources.FailureMechanismProperties_Contribution_Other_Percentage_0,
+ assessmentSection.GetContributingFailureMechanisms().Single(fm => fm is OtherFailureMechanism).Contribution);
+ }
+ }
+
+ [PropertyOrder(inAssemblyPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_InAssembly_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.FailurePath_InAssembly_Description))]
+ public bool InAssembly
+ {
+ get
+ {
+ return data.InAssembly;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -r3192f0b781afb4da048556c46e1b78c4079d05e4 -r27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 3192f0b781afb4da048556c46e1b78c4079d05e4)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
@@ -257,6 +257,10 @@
{
CreateInstance = context => new PipingStructureFailurePathProperties(context.WrappedData)
};
+ yield return new PropertyInfo
+ {
+ CreateInstance = context => new StrengthStabilityLengthwiseConstructionFailurePathProperties(context.WrappedData, context.Parent)
+ };
yield return new PropertyInfo, CalculationGroupContextProperties>
{
CreateInstance = context => new CalculationGroupContextProperties(context)
Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/PropertyClasses/StandAlone/StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest.cs (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
@@ -0,0 +1,335 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.ComponentModel;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using Core.Gui.PropertyBag;
+using Core.Gui.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Contribution;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PropertyClasses.StandAlone;
+
+namespace Riskeer.Integration.Forms.Test.PropertyClasses.StandAlone
+{
+ public class StrengthStabilityLengthwiseConstructionFailurePathPropertiesTest
+ {
+ private const int namePropertyIndex = 0;
+ private const int codePropertyIndex = 1;
+ private const int groupPropertyIndex = 2;
+ private const int contributionPropertyIndex = 3;
+ private const int inAssemblyPropertyIndex = 4;
+ private const int nPropertyIndex = 5;
+ private const int applyLengthEffectInSectionPropertyIndex = 6;
+
+ [Test]
+ public void Constructor_DataNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ void Call() => new StrengthStabilityLengthwiseConstructionFailurePathProperties(null, assessmentSection);
+
+ // Assert
+ string paramName = Assert.Throws(Call).ParamName;
+ Assert.AreEqual("failureMechanism", paramName);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowArgumentNullException()
+ {
+ // Call
+ void Call() => new StrengthStabilityLengthwiseConstructionFailurePathProperties(new StrengthStabilityLengthwiseConstructionFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(21);
+ double otherContribution = random.NextDouble();
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ InAssembly = random.NextBoolean()
+ };
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(section => section.GetContributingFailureMechanisms()).Return(new IFailureMechanism[]
+ {
+ failureMechanism,
+ new OtherFailureMechanism
+ {
+ Contribution = otherContribution
+ }
+ });
+ mocks.ReplayAll();
+
+ // Call
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf>(properties);
+ Assert.AreEqual(failureMechanism.Name, properties.Name);
+ Assert.AreEqual(failureMechanism.Code, properties.Code);
+ Assert.AreEqual(failureMechanism.Group, properties.Group);
+ Assert.AreEqual($"Overig ({otherContribution})", properties.Contribution);
+ Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly);
+
+ Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces);
+ Assert.AreEqual(failureMechanism.GeneralInput.N,
+ properties.N,
+ properties.N.GetAccuracy());
+ Assert.IsFalse(properties.ApplyLengthEffectInSection);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_InAssemblyTrue_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ InAssembly = true
+ };
+
+ // Call
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+ const string lengthEffectCategory = "Lengte-effect";
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor labelProperty = dynamicProperties[codePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor groupProperty = dynamicProperties[groupPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(groupProperty,
+ generalCategory,
+ "Groep",
+ "De groep waar het toetsspoor toe behoort.",
+ true);
+
+ PropertyDescriptor contributionProperty = dynamicProperties[contributionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(contributionProperty,
+ generalCategory,
+ "Faalkansbijdrage [%]",
+ "Procentuele bijdrage van dit toetsspoor aan de totale overstromingskans van het traject.",
+ true);
+
+ PropertyDescriptor inAssemblyProperty = dynamicProperties[inAssemblyPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(inAssemblyProperty,
+ generalCategory,
+ "In assemblage",
+ "Geeft aan of dit faalpad wordt meegenomen in de assemblage.",
+ true);
+
+ PropertyDescriptor nProperty = dynamicProperties[nPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty,
+ lengthEffectCategory,
+ "N [-]",
+ "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling.");
+
+ PropertyDescriptor applySectionLengthInSectionProperty = dynamicProperties[applyLengthEffectInSectionPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(applySectionLengthInSectionProperty,
+ lengthEffectCategory,
+ "Toepassen lengte-effect binnen vak",
+ "Geeft aan of het lengte-effect binnen een vak toegepast wordt.",
+ true);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_InAssemblyFalse_PropertiesHaveExpectedAttributesValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ InAssembly = false
+ };
+
+ // Call
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Assert
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(4, dynamicProperties.Count);
+
+ const string generalCategory = "Algemeen";
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het toetsspoor.",
+ true);
+
+ PropertyDescriptor labelProperty = dynamicProperties[codePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty,
+ generalCategory,
+ "Label",
+ "Het label van het toetsspoor.",
+ true);
+
+ PropertyDescriptor groupProperty = dynamicProperties[groupPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(groupProperty,
+ generalCategory,
+ "Groep",
+ "De groep waar het toetsspoor toe behoort.",
+ true);
+
+ PropertyDescriptor inAssemblyProperty = dynamicProperties[inAssemblyPropertyIndex - 1];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(inAssemblyProperty,
+ generalCategory,
+ "In assemblage",
+ "Geeft aan of dit faalpad wordt meegenomen in de assemblage.",
+ true);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ [TestCase(-1)]
+ [TestCase(0.9)]
+ [TestCase(20.1)]
+ [TestCase(30)]
+ public void N_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ failureMechanism.Attach(observer);
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Call
+ void Call() => properties.N = (RoundedDouble) value;
+
+ // Assert
+ const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(1)]
+ [TestCase(12)]
+ [TestCase(20)]
+ public void N_SetValidValue_SetsValueAndUpdatesObserver(double value)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ failureMechanism.Attach(observer);
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Call
+ properties.N = (RoundedDouble) value;
+
+ // Assert
+ Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy());
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void DynamicVisibleValidationMethod_DependingOnInAssembly_ReturnExpectedVisibility(bool inAssembly)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ InAssembly = inAssembly
+ };
+ var properties = new StrengthStabilityLengthwiseConstructionFailurePathProperties(failureMechanism, assessmentSection);
+
+ // Call & Assert
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Name)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Group)));
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.InAssembly)));
+
+ Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.Contribution)));
+ Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.N)));
+ Assert.AreEqual(inAssembly, properties.DynamicVisibleValidationMethod(nameof(properties.ApplyLengthEffectInSection)));
+
+ Assert.IsTrue(properties.DynamicVisibleValidationMethod(null));
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/StrengthStabilityLengthwiseConstructionFailurePathPropertyInfoTest.cs
===================================================================
diff -u
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/StrengthStabilityLengthwiseConstructionFailurePathPropertyInfoTest.cs (revision 0)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/PropertyInfos/StrengthStabilityLengthwiseConstructionFailurePathPropertyInfoTest.cs (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
@@ -0,0 +1,81 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Gui.Plugin;
+using Core.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Integration.Data.StandAlone;
+using Riskeer.Integration.Forms.PresentationObjects.StandAlone;
+using Riskeer.Integration.Forms.PropertyClasses.StandAlone;
+
+namespace Riskeer.Integration.Plugin.Test.PropertyInfos
+{
+ [TestFixture]
+ public class StrengthStabilityLengthwiseConstructionFailurePathPropertyInfoTest
+ {
+ private RiskeerPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new RiskeerPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(StrengthStabilityLengthwiseConstructionFailurePathProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(StrengthStabilityLengthwiseConstructionFailurePathContext), info.DataType);
+ Assert.AreEqual(typeof(StrengthStabilityLengthwiseConstructionFailurePathProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_NewPropertiesWithFailureMechanismAsData()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ var context = new StrengthStabilityLengthwiseConstructionFailurePathContext(failureMechanism, assessmentSection);
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(failureMechanism, objectProperties.Data);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs
===================================================================
diff -u -r8d667bcf47df168bda37270bdf8ea0cee98398d1 -r27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 8d667bcf47df168bda37270bdf8ea0cee98398d1)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/RiskeerPluginTest.cs (.../RiskeerPluginTest.cs) (revision 27e15c66ffe310fa9ae3fb77ad8aa0b30e6b3cd0)
@@ -218,7 +218,7 @@
PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray();
// Assert
- Assert.AreEqual(27, propertyInfos.Length);
+ Assert.AreEqual(28, propertyInfos.Length);
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
@@ -262,6 +262,11 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
+ typeof(StrengthStabilityLengthwiseConstructionFailurePathContext),
+ typeof(StrengthStabilityLengthwiseConstructionFailurePathProperties));
+
+ PluginTestHelper.AssertPropertyInfoDefined(
+ propertyInfos,
typeof(ICalculationContext),
typeof(CalculationGroupContextProperties));
@@ -396,10 +401,10 @@
mockRepository.ReplayAll();
using (var plugin = new RiskeerPlugin
+ {
+ Gui = gui
+ })
{
- Gui = gui
- })
- {
// Call
ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray();