Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs =================================================================== diff -u -rfe90a6d174a01975381e6cda55ed1f7f4e831a51 -r390c486bb4cd693ae2f2eaf82a30efcb51480048 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision fe90a6d174a01975381e6cda55ed1f7f4e831a51) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision 390c486bb4cd693ae2f2eaf82a30efcb51480048) @@ -47,6 +47,39 @@ private const string illustrationPointsCategoryName = "Illustratiepunten"; [Test] + public void Constructor_IllustrationPointNodeNull_ThrowsArgumentNullException() + { + // 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_ThrowsException() + { + // 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 @@ -60,46 +93,59 @@ } [Test] - public void Constructor_FaultTreeIllustrationPoint_CorrectValues() + public void Constructor_SubMechanismIllustrationPoint_CorrectValues() { // Call - var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode( - new TestSubMechanismIllustrationPoint(new[] - { - new SubMechanismIllustrationPointStochast("Test", 2.0, 4.5, 0.1) - })), - "N", "closing situation"); + var subMechanismIllustrationPoint = new SubMechanismIllustrationPoint("Submechanism A", + 5.4, + new[] + { + new SubMechanismIllustrationPointStochast("Test", 2.0, 4.5, 0.1) + }, + Enumerable.Empty()); + var subMechanismProperties = new SubMechanismIllustrationPointProperties(new IllustrationPointNode(subMechanismIllustrationPoint), + "N", + "closing situation"); // Assert Assert.AreEqual("N", subMechanismProperties.WindDirection); TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.Reliability)); - Assert.AreEqual(3.14, subMechanismProperties.Reliability.Value); + Assert.AreEqual(5.4, subMechanismProperties.Reliability.Value); Assert.AreEqual(5, subMechanismProperties.Reliability.NumberOfDecimalPlaces); TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.CalculatedProbability)); - Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(3.14), subMechanismProperties.CalculatedProbability); + Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(5.4), subMechanismProperties.CalculatedProbability); Assert.AreEqual("closing situation", subMechanismProperties.ClosingSituation); TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.AlphaValues)); CollectionAssert.IsNotEmpty(subMechanismProperties.AlphaValues); Assert.AreEqual(1, subMechanismProperties.AlphaValues.Length); - Assert.AreEqual(4.5, subMechanismProperties.AlphaValues.First().Alpha); + foreach (SubMechanismIllustrationPointStochast alphaValue in subMechanismProperties.AlphaValues) + { + Assert.AreEqual(4.5, alphaValue.Alpha); + } TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.Durations)); CollectionAssert.IsNotEmpty(subMechanismProperties.Durations); Assert.AreEqual(1, subMechanismProperties.Durations.Length); - Assert.AreEqual(2.0, subMechanismProperties.Durations.First().Duration); + foreach (SubMechanismIllustrationPointStochast duration in subMechanismProperties.Durations) + { + Assert.AreEqual(2.0, duration.Duration); + } TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.SubMechanismStochasts)); CollectionAssert.IsNotEmpty(subMechanismProperties.SubMechanismStochasts); Assert.AreEqual(1, subMechanismProperties.SubMechanismStochasts.Length); - Assert.AreEqual(0.1, subMechanismProperties.SubMechanismStochasts.First().Realization); + foreach (SubMechanismIllustrationPointStochast realization in subMechanismProperties.SubMechanismStochasts) + { + Assert.AreEqual(0.1, realization.Realization); + } TestHelper.AssertTypeConverter( nameof(SubMechanismIllustrationPointProperties.IllustrationPoints));