Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs =================================================================== diff -u -rdf0dfaac54b07c9d3dc72b6db2d97f090b971314 -r9c8a4be86a9b3659738256e8f1c0542339d7b16a --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision df0dfaac54b07c9d3dc72b6db2d97f090b971314) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision 9c8a4be86a9b3659738256e8f1c0542339d7b16a) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.ComponentModel; using Core.Common.Gui.Converters; using Core.Common.TestUtil; @@ -48,60 +47,8 @@ private const string illustrationPointsCategoryName = "Illustratiepunten"; [Test] - public void Constructor_IllustrationPointNodeNull_ThrowsArgumentNullException() + public void Constructor_ExpectedValues() { - // Call - TestDelegate test = () => new SubMechanismIllustrationPointProperties(null, - "Point name A", - "Closing Situation"); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("illustrationPointNode", paramName); - } - - [Test] - public void Constructor_WindDirectionNull_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), - null, - "Closing Situation"); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("windDirection", paramName); - } - - [Test] - public void Constructor_ClosingSituationNull_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), - "SE", - null); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("closingSituation", paramName); - } - - [Test] - public void Constructor_InvalidIllustrationPointType_ThrowsArgumentException() - { - // Call - TestDelegate test = () => new SubMechanismIllustrationPointProperties(new IllustrationPointNode( - new TestIllustrationPoint()), - "N", "Regular"); - - // Assert - const string expectedMessage = "illustrationPointNode type has to be SubMechanismIllustrationPoint"; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); - } - - [Test] - public void Constructor_SubMechanismIllustrationPoint_CorrectValues() - { // Setup const string windDirection = "N"; const string closingSituation = "closing situation"; @@ -117,11 +64,13 @@ }); // Call - var properties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(illustrationPoint), + var properties = new SubMechanismIllustrationPointProperties(illustrationPoint, + new IllustrationPointNode[0], windDirection, closingSituation); // Assert + Assert.IsInstanceOf(properties); PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex]; @@ -172,8 +121,12 @@ [Test] public void Constructor_WithSubMechanismIllustrationPoint_PropertiesHaveExpectedAttributesValues() { + // Setup + var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); + // Call - var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), + var subMechanismProperties = new SubMechanismIllustrationPointProperties(illustrationPointNode.Data, + new IllustrationPointNode[0], "N", "Regular"); @@ -237,82 +190,5 @@ "Waarden van variabelen in het illustratiepunt.", true); } - - [Test] - public void Constructor_HiddenClosingSituation_PropertiesHaveExpectedAttributesValues() - { - // Call - var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), - "N", - string.Empty); - - // Assert - PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(subMechanismProperties); - Assert.AreEqual(7, dynamicProperties.Count); - - PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, - illustrationPointsCategoryName, - "Berekende kans [1/jaar]", - "De berekende kans van voorkomen van het berekende resultaat.", - true); - - PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, - illustrationPointsCategoryName, - "Betrouwbaarheidsindex berekende kans [-]", - "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", - true); - - PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, - illustrationPointsCategoryName, - "Windrichting", - "De windrichting waarvoor dit illlustratiepunt is berekend.", - true); - - PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex - 1]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty, - illustrationPointsCategoryName, - "Alfa's [-]", - "Berekende invloedscoƫfficiƫnten voor alle beschouwde stochasten.", - true); - - PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex - 1]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, - illustrationPointsCategoryName, - "Tijdsduren [min]", - "Tijdsduren waarop de stochasten betrekking hebben.", - true); - - PropertyDescriptor realizationsProperty = dynamicProperties[realizationsPropertyIndex - 1]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(realizationsProperty, - illustrationPointsCategoryName, - "Realisaties in het illustratiepunt", - "Realisaties van de stochasten in het illustratiepunt.", - true); - - PropertyDescriptor resultsProperty = dynamicProperties[resultsPropertyIndex - 1]; - PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultsProperty, - illustrationPointsCategoryName, - "Waarden in het illustratiepunt", - "Waarden van variabelen in het illustratiepunt.", - true); - } - - [Test] - public void ToString_CorrectValue_ReturnsCorrectString() - { - // Setup - var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint("Relevant")), - "NotRelevant", - "ClosingSit"); - - // Call - string toString = subMechanismProperties.ToString(); - - // Assert - Assert.AreEqual(toString, "Relevant"); - } } } \ No newline at end of file