Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointBaseProperties.cs =================================================================== diff -u -r0247a9558110b4efa96a4b38a8a5cf4bb611d650 -r96fff655a391d41dec6fe60625bfbc009ed1f467 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointBaseProperties.cs (.../FaultTreeIllustrationPointBaseProperties.cs) (revision 0247a9558110b4efa96a4b38a8a5cf4bb611d650) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointBaseProperties.cs (.../FaultTreeIllustrationPointBaseProperties.cs) (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -35,7 +35,7 @@ namespace Ringtoets.Common.Forms.PropertyClasses { /// - /// Properties for the Fault tree of Illustration Points. + /// Properties for the fault tree illustration points. /// [TypeConverter(typeof(ExpandableObjectConverter))] public class FaultTreeIllustrationPointBaseProperties : ObjectProperties Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointChildProperties.cs =================================================================== diff -u -r0247a9558110b4efa96a4b38a8a5cf4bb611d650 -r96fff655a391d41dec6fe60625bfbc009ed1f467 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointChildProperties.cs (.../FaultTreeIllustrationPointChildProperties.cs) (revision 0247a9558110b4efa96a4b38a8a5cf4bb611d650) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/FaultTreeIllustrationPointChildProperties.cs (.../FaultTreeIllustrationPointChildProperties.cs) (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -31,7 +31,7 @@ namespace Ringtoets.Common.Forms.PropertyClasses { /// - /// Properties for the (child) Fault tree of Illustration Points + /// Properties for the fault tree illustration points /// [TypeConverter(typeof(ExpandableObjectConverter))] public class FaultTreeIllustrationPointChildProperties : IllustrationPointChildProperties @@ -48,7 +48,7 @@ { if (!(data.Data is FaultTreeIllustrationPoint)) { - throw new ArgumentException("illustrationPointNode data type has to be FaultTreeIllustrationPoint"); + throw new ArgumentException("illustrationPointNode type has to be FaultTreeIllustrationPoint"); } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointChildProperties.cs =================================================================== diff -u -r0247a9558110b4efa96a4b38a8a5cf4bb611d650 -r96fff655a391d41dec6fe60625bfbc009ed1f467 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointChildProperties.cs (.../SubMechanismIllustrationPointChildProperties.cs) (revision 0247a9558110b4efa96a4b38a8a5cf4bb611d650) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/SubMechanismIllustrationPointChildProperties.cs (.../SubMechanismIllustrationPointChildProperties.cs) (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -31,7 +31,7 @@ namespace Ringtoets.Common.Forms.PropertyClasses { /// - /// Properties for the Submechanism Illustration Points. + /// Properties for the submechanism illustration points. /// [TypeConverter(typeof(ExpandableObjectConverter))] public class SubMechanismIllustrationPointChildProperties : IllustrationPointChildProperties @@ -48,7 +48,7 @@ { if (!(data.Data is SubMechanismIllustrationPoint)) { - throw new ArgumentException("illustrationPointNode data type has to be SubMechanismIllustrationPoint"); + throw new ArgumentException("illustrationPointNode type has to be SubMechanismIllustrationPoint"); } } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointBasePropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointBasePropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointBasePropertiesTest.cs (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -0,0 +1,107 @@ +// 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.TestUtil; +using Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class FaultTreeIllustrationPointBasePropertiesTest + { + [Test] + public void Constructor_Null_ThrowsException() + { + // Setup + const string expectedMessage = "Value cannot be null."; + + // Call + TestDelegate test = () => new FaultTreeIllustrationPointBaseProperties(null); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_FaultTreeIllustrationPoint_CorrectValues() + { + // Setup + var topLevel = new TopLevelFaultTreeIllustrationPoint( + new WindDirection("N", 5.0), + "closing situation", + new IllustrationPointNode(new FaultTreeIllustrationPoint("N", 7.2, new Stochast[0], CombinationType.And))); + topLevel.FaultTreeNodeRoot.SetChildren(new[] + { + new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 7.2, + new Stochast[0], + CombinationType.And)), + new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 7.2, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])) + }); + + // Call + var faultTree = new FaultTreeIllustrationPointBaseProperties(topLevel); + + // Assert + Assert.AreEqual(faultTree.WindDirection, "N"); + Assert.AreEqual(faultTree.Reliability.Value, 7.2); + Assert.AreEqual(faultTree.Reliability.NumberOfDecimalPlaces, 5); + Assert.AreEqual(faultTree.CalculatedProbability, StatisticsConverter.ReliabilityToProbability(7.2)); + Assert.AreEqual(faultTree.ClosingSituation, "closing situation"); + + Assert.IsNotNull(faultTree.AlphaValues); + Assert.AreEqual(faultTree.AlphaValues.Length, 0); + + Assert.IsNotNull(faultTree.Durations); + Assert.AreEqual(faultTree.Durations.Length, 0); + + Assert.IsNotNull(faultTree.IllustrationPoints); + Assert.AreEqual(faultTree.IllustrationPoints.Length, 2); + } + + [Test] + public void ToString_CorrectValue_ReturnsCorrectString() + { + // Setup + var faultTree = new FaultTreeIllustrationPointBaseProperties( + new TopLevelFaultTreeIllustrationPoint( + new WindDirection("SSE", 5.0), + "closing situation", + new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])))); + + // Call + string toString = faultTree.ToString(); + + // Assert + Assert.AreEqual(toString, "SSE"); + } + } +} \ No newline at end of file Fisheye: Tag 96fff655a391d41dec6fe60625bfbc009ed1f467 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointBasePropertyTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointChildPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointChildPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointChildPropertiesTest.cs (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -0,0 +1,257 @@ +// 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.TestUtil; +using Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class FaultTreeIllustrationPointChildPropertiesTest + { + private const int probabilityPropertyIndex = 0; + private const int reliabilityPropertyIndex = 1; + private const int windDirectionPropertyIndex = 2; + private const int closingScenarioPropertyIndex = 3; + private const int alphasPropertyIndex = 4; + private const int durationsPropertyIndex = 5; + private const int illustrationPointPropertyIndex = 6; + + private const string illustrationPointsCategoryName = "Illustratiepunten"; + + [Test] + public void Constructor_InvalidIllustrationPointType_ThrowsException() + { + // Setup + const string expectedMessage = "illustrationPointNode data type has to be FaultTreeIllustrationPoint"; + + // Call + TestDelegate test = () => new FaultTreeIllustrationPointChildProperties(new IllustrationPointNode(new TestSubMechanismIllustrationPoint()), "N"); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_FaultTreeIllustrationPoint_CorrectValues() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 1.5, + new Stochast[0], + CombinationType.And)); + var illustrationPointNodeChild = new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 3.5, + new Stochast[0], + CombinationType.Or)); + var illustrationPointNodeChildren = new[] + { + illustrationPointNodeChild, + illustrationPointNodeChild + }; + illustrationPointNode.SetChildren(illustrationPointNodeChildren); + + // Call + var faultTree = new FaultTreeIllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + Assert.AreEqual(faultTree.WindDirection, "N"); + Assert.AreEqual(faultTree.Reliability.Value, 1.5); + Assert.AreEqual(faultTree.Reliability.NumberOfDecimalPlaces, 5); + Assert.AreEqual(faultTree.CalculatedProbability, StatisticsConverter.ReliabilityToProbability(1.5)); + Assert.AreEqual(faultTree.Name, "N"); + + Assert.IsNotNull(faultTree.AlphaValues); + Assert.AreEqual(faultTree.AlphaValues.Length, 0); + + Assert.IsNotNull(faultTree.Durations); + Assert.AreEqual(faultTree.Durations.Length, 0); + + Assert.IsNotNull(faultTree.IllustrationPoints); + Assert.AreEqual(faultTree.IllustrationPoints.Length, 2); + Assert.AreEqual(faultTree.IllustrationPoints[0].WindDirection, "N"); + Assert.AreEqual(faultTree.IllustrationPoints[0].Name, "N"); + Assert.AreEqual(faultTree.IllustrationPoints[0].CalculatedProbability, StatisticsConverter.ReliabilityToProbability(3.5)); + Assert.AreEqual(faultTree.IllustrationPoints[0].Reliability, 3.5); + Assert.AreEqual(faultTree.IllustrationPoints[0].IllustrationPoints.Length, 0); + } + + [Test] + public void Constructor_WithChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 1.5, + new Stochast[0], + CombinationType.And)); + illustrationPointNode.SetChildren(new[] + { + new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 7.2, + new Stochast[0], + CombinationType.And)), + new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 7.2, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])) + }); + + // Call + var faultTree = new FaultTreeIllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree); + 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 closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, + illustrationPointsCategoryName, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty, + illustrationPointsCategoryName, + "Alfa's [-]", + "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", + true); + + PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, + illustrationPointsCategoryName, + "Tijdsduren [min]", + "Tijdsduren waarop de stochasten betrekking hebben.", + true); + + PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty, + illustrationPointsCategoryName, + "Illustratiepunten", + "", + true); + } + + [Test] + public void Constructor_WithoutChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues() + { + // Setup + // Setup + var illustrationPointNode = new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 1.5, + new Stochast[0], + CombinationType.And)); + + // Call + var faultTree = new FaultTreeIllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree); + Assert.AreEqual(6, 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 closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, + illustrationPointsCategoryName, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty, + illustrationPointsCategoryName, + "Alfa's [-]", + "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", + true); + + PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, + illustrationPointsCategoryName, + "Tijdsduren [min]", + "Tijdsduren waarop de stochasten betrekking hebben.", + true); + } + + [Test] + public void ToString_CorrectValue_ReturnsCorrectString() + { + // Setup + var faultTree = new FaultTreeIllustrationPointChildProperties(new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 1.5, + new Stochast[0], + CombinationType.And)), + "N"); + + // Call + string toString = faultTree.ToString(); + + // Assert + Assert.AreEqual(toString, "N"); + } + } +} \ No newline at end of file Fisheye: Tag 96fff655a391d41dec6fe60625bfbc009ed1f467 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointChildPropertyTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointChildPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointChildPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointChildPropertiesTest.cs (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -0,0 +1,245 @@ +// 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.TestUtil; +using Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class IllustrationPointChildPropertiesTest + { + private const string illustrationPointCategoryName = "Illustratiepunten"; + + [Test] + public void Constructor_IllustrationPointNodeNull_ThrowsException() + { + // Setup + const string expectedMessage = "Value cannot be null."; + + // Call + TestDelegate test = () => new IllustrationPointChildProperties(null, "N"); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_WindDirectionNull_ThrowsException() + { + // Setup + const string expectedMessage = "Value cannot be null."; + + // Call + TestDelegate test = () => new IllustrationPointChildProperties(new IllustrationPointNode(new TestIllustrationPoint()), null); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_FaultTreeIllustrationPointWithoutChildren_CorrectValues() + { + // Setup + + // Call + var faultTree = new IllustrationPointChildProperties(new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])), + "N"); + + // Assert + Assert.AreEqual(faultTree.WindDirection, "N"); + Assert.AreEqual(faultTree.Reliability.Value, 1.5); + Assert.AreEqual(faultTree.Reliability.NumberOfDecimalPlaces, 5); + Assert.AreEqual(faultTree.CalculatedProbability, StatisticsConverter.ReliabilityToProbability(1.5)); + Assert.AreEqual(faultTree.Name, "N"); + + Assert.IsNotNull(faultTree.IllustrationPoints); + Assert.AreEqual(faultTree.IllustrationPoints.Length, 0); + } + + [Test] + public void Constructor_FaultTreeIllustrationPointWithChildren_CorrectValues() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])); + illustrationPointNode.SetChildren(new[] + { + new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 7.2, + new Stochast[0], + CombinationType.And)), + new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 7.2, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])) + }); + + // Call + var faultTree = new IllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + Assert.AreEqual(faultTree.WindDirection, "N"); + Assert.AreEqual(faultTree.Reliability.Value, 1.5); + Assert.AreEqual(faultTree.Reliability.NumberOfDecimalPlaces, 5); + Assert.AreEqual(faultTree.CalculatedProbability, StatisticsConverter.ReliabilityToProbability(1.5)); + Assert.AreEqual(faultTree.Name, "N"); + + Assert.IsNotNull(faultTree.IllustrationPoints); + Assert.AreEqual(faultTree.IllustrationPoints.Length, 2); + } + + [Test] + public void ToString_CorrectValue_ReturnsCorrectString() + { + // Setup + var faultTree = new IllustrationPointChildProperties(new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])), + "N"); + + // Call + string toString = faultTree.ToString(); + + // Assert + Assert.AreEqual(toString, "N"); + } + + [Test] + public void Constructor_WithChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])); + illustrationPointNode.SetChildren(new[] + { + new IllustrationPointNode(new FaultTreeIllustrationPoint("N", + 7.2, + new Stochast[0], + CombinationType.And)), + new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 7.2, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])) + }); + + // Call + var faultTree = new IllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree); + Assert.AreEqual(5, dynamicProperties.Count); + + PropertyDescriptor probabilityProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, + illustrationPointCategoryName, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor reliabilityProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, + illustrationPointCategoryName, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor windDirectionProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, + illustrationPointCategoryName, + "Windrichting", + "De windrichting waarvoor dit illlustratiepunt is berekend.", + true); + + PropertyDescriptor closingScenarioProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, + illustrationPointCategoryName, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + PropertyDescriptor illustrationPointProperty = dynamicProperties[4]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty, + illustrationPointCategoryName, + "Illustratiepunten", + "", + true); + } + + [Test] + public void Constructor_WithoutChildIllustrationPointNodes_PropertiesHaveExpectedAttributesValues() + { + // Setup + var illustrationPointNode = new IllustrationPointNode(new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])); + // Call + var faultTree = new IllustrationPointChildProperties(illustrationPointNode, "N"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree); + Assert.AreEqual(4, dynamicProperties.Count); + + PropertyDescriptor probabilityProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, + illustrationPointCategoryName, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor reliabilityProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, + illustrationPointCategoryName, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor windDirectionProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, + illustrationPointCategoryName, + "Windrichting", + "De windrichting waarvoor dit illlustratiepunt is berekend.", + true); + + PropertyDescriptor closingScenarioProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, + illustrationPointCategoryName, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + } + } +} \ No newline at end of file Fisheye: Tag 96fff655a391d41dec6fe60625bfbc009ed1f467 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointChildPropertyTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointChildPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointChildPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointChildPropertiesTest.cs (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -0,0 +1,157 @@ +// 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.TestUtil; +using Core.Common.Utils; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class SubMechanismIllustrationPointChildPropertiesTest + { + private const int probabilityPropertyIndex = 0; + private const int reliabilityPropertyIndex = 1; + private const int windDirectionPropertyIndex = 2; + private const int closingScenarioPropertyIndex = 3; + private const int subMechanismStochastPropertyIndex = 4; + + private const string illustrationPointsCategoryName = "Illustratiepunten"; + + [Test] + public void Constructor_InvalidIllustrationPointType_ThrowsException() + { + // Setup + const string expectedMessage = "illustrationPointNode data type has to be SubMechanismIllustrationPoint"; + + // Call + TestDelegate test = () => new SubMechanismIllustrationPointChildProperties(new IllustrationPointNode( + new FaultTreeIllustrationPoint("N", + 1.5, + new Stochast[0], + CombinationType.And)), + "N"); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void Constructor_FaultTreeIllustrationPoint_CorrectValues() + { + // Setup + + // Call + var faultTree = new SubMechanismIllustrationPointChildProperties(new IllustrationPointNode( + new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])), + "N"); + + // Assert + Assert.AreEqual(faultTree.WindDirection, "N"); + Assert.AreEqual(faultTree.Reliability.Value, 1.5); + Assert.AreEqual(faultTree.Reliability.NumberOfDecimalPlaces, 5); + Assert.AreEqual(faultTree.CalculatedProbability, StatisticsConverter.ReliabilityToProbability(1.5)); + Assert.AreEqual(faultTree.Name, "N"); + + Assert.IsNotNull(faultTree.SubMechanismStochasts); + Assert.AreEqual(faultTree.SubMechanismStochasts.Length, 0); + + Assert.IsNotNull(faultTree.IllustrationPoints); + Assert.AreEqual(faultTree.IllustrationPoints.Length, 0); + } + + [Test] + public void Constructor_WithSubMechanismIllustrationPoint_PropertiesHaveExpectedAttributesValues() + { + // Call + var faultTree = new SubMechanismIllustrationPointChildProperties(new IllustrationPointNode( + new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])), + "N"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(faultTree); + Assert.AreEqual(5, 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 closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, + illustrationPointsCategoryName, + "Sluitscenario", + "Het sluitscenario waarvoor dit illustratiepunt is berekend.", + true); + + PropertyDescriptor subMechanismStochastProperty = dynamicProperties[subMechanismStochastPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(subMechanismStochastProperty, + illustrationPointsCategoryName, + "Waarden in het illustratiepunt", + "Realisaties van de stochasten in het illustratiepunt", + true); + } + + [Test] + public void ToString_CorrectValue_ReturnsCorrectString() + { + // Setup + var faultTree = new SubMechanismIllustrationPointChildProperties(new IllustrationPointNode( + new SubMechanismIllustrationPoint("N", + 1.5, + new SubMechanismIllustrationPointStochast[0], + new IllustrationPointResult[0])), + "N"); + + // Call + string toString = faultTree.ToString(); + + // Assert + Assert.AreEqual(toString, "N"); + } + } +} \ No newline at end of file Fisheye: Tag 96fff655a391d41dec6fe60625bfbc009ed1f467 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointChildPropertyTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -reea09a6357b41d9773a802b22f921817fda018ef -r96fff655a391d41dec6fe60625bfbc009ed1f467 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision eea09a6357b41d9773a802b22f921817fda018ef) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) @@ -90,10 +90,10 @@ - - - - + + + +