Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeFaultTreeContext.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeFaultTreeContext.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeFaultTreeContext.cs (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -0,0 +1,85 @@ +// 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 Ringtoets.Common.Data.IllustrationPoints; + +namespace Ringtoets.Common.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for an which' + /// is of type . + /// + public class IllustrationPointNodeFaultTreeContext + { + /// + /// Creates a new instance of . + /// + /// The illustration point node. + /// The name of the wind direction. + /// The closing situation of the illustration point. + /// Thrown when any of the input parameters is null. + /// Thrown when + /// is not of type . + public IllustrationPointNodeFaultTreeContext(IllustrationPointNode illustrationPointNode, + string windDirectionName, + string closingSituation) + { + if (illustrationPointNode == null) + { + throw new ArgumentNullException(nameof(illustrationPointNode)); + } + if (windDirectionName == null) + { + throw new ArgumentNullException(nameof(windDirectionName)); + } + if (closingSituation == null) + { + throw new ArgumentNullException(nameof(closingSituation)); + } + + var illustrationPoint = illustrationPointNode.Data as FaultTreeIllustrationPoint; + if (illustrationPoint == null) + { + throw new ArgumentException($"{nameof(illustrationPointNode)} type has to be {nameof(FaultTreeIllustrationPoint)}"); + } + + IllustrationPointNode = illustrationPointNode; + WindDirectionName = windDirectionName; + ClosingSituation = closingSituation; + } + + /// + /// Gets the illustration point node. + /// + public IllustrationPointNode IllustrationPointNode { get; } + + /// + /// Gets the wind direction name. + /// + public string WindDirectionName { get; } + + /// + /// Gets the closing situation. + /// + public string ClosingSituation { get; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeSubMechanismContext.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeSubMechanismContext.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/IllustrationPointNodeSubMechanismContext.cs (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -0,0 +1,85 @@ +// 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 Ringtoets.Common.Data.IllustrationPoints; + +namespace Ringtoets.Common.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for an which' + /// is of type . + /// + public class IllustrationPointNodeSubMechanismContext + { + /// + /// Creates a new instance of . + /// + /// The illustration point node. + /// The name of the wind direction. + /// The closing situation of the illustration point. + /// Thrown when any of the input parameters is null. + /// Thrown when + /// is not of type . + public IllustrationPointNodeSubMechanismContext(IllustrationPointNode illustrationPointNode, + string windDirectionName, + string closingSituation) + { + if (illustrationPointNode == null) + { + throw new ArgumentNullException(nameof(illustrationPointNode)); + } + if (windDirectionName == null) + { + throw new ArgumentNullException(nameof(windDirectionName)); + } + if (closingSituation == null) + { + throw new ArgumentNullException(nameof(closingSituation)); + } + + var illustrationPoint = illustrationPointNode.Data as SubMechanismIllustrationPoint; + if (illustrationPoint == null) + { + throw new ArgumentException($"{nameof(illustrationPointNode)} type has to be {nameof(SubMechanismIllustrationPoint)}"); + } + + IllustrationPointNode = illustrationPointNode; + WindDirectionName = windDirectionName; + ClosingSituation = closingSituation; + } + + /// + /// Gets the illustration point node. + /// + public IllustrationPointNode IllustrationPointNode { get; } + + /// + /// Gets the wind direction name. + /// + public string WindDirectionName { get; } + + /// + /// Gets the closing situation. + /// + public string ClosingSituation { get; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -ref24d21af048d00837c7858066d83661106f550a -r02de9412f0e856e0ab90df7d1aeff0278b4d2f07 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision ef24d21af048d00837c7858066d83661106f550a) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -78,6 +78,8 @@ + + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeFaultTreeContextTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeFaultTreeContextTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeFaultTreeContextTest.cs (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -0,0 +1,105 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class IllustrationPointNodeFaultTreeContextTest + { + [Test] + public void Constructor_IllustrationPointNodeNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new IllustrationPointNodeFaultTreeContext(null, "", ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("illustrationPointNode", exception.ParamName); + } + + [Test] + public void Constructor_WindDirectionNameNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeFaultTreeContext(node, null, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("windDirectionName", exception.ParamName); + } + + [Test] + public void Constructor_ClosingSituationNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeFaultTreeContext(node, "", null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("closingSituation", exception.ParamName); + } + + [Test] + public void Constructor_IllustrationPointNodeInvalidType_ThrowsArgumentException() + { + // Setup + var node = new IllustrationPointNode(new TestIllustrationPoint()); + const string windDirectionName = "wdn"; + const string closingSituation = "cs"; + + // Call + TestDelegate test = () => new IllustrationPointNodeFaultTreeContext(node, windDirectionName, closingSituation); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("illustrationPointNode type has to be FaultTreeIllustrationPoint", exception.Message); + } + + [Test] + public void Constructor_ValidParameters_ExpectedProperties() + { + // Setup + var node = new IllustrationPointNode(new TestFaultTreeIllustrationPoint()); + const string windDirectionName = "wdn"; + const string closingSituation = "cs"; + + // Call + var context = new IllustrationPointNodeFaultTreeContext(node, windDirectionName, closingSituation); + + // Assert + Assert.AreSame(node, context.IllustrationPointNode); + Assert.AreEqual(windDirectionName, context.WindDirectionName); + Assert.AreEqual(closingSituation, context.ClosingSituation); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeSubMechanismContextTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeSubMechanismContextTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/IllustrationPointNodeSubMechanismContextTest.cs (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -0,0 +1,105 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class IllustrationPointNodeSubMechanismContextTest + { + [Test] + public void Constructor_IllustrationPointNodeNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new IllustrationPointNodeSubMechanismContext(null, "", ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("illustrationPointNode", exception.ParamName); + } + + [Test] + public void Constructor_WindDirectionNameNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeSubMechanismContext(node, null, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("windDirectionName", exception.ParamName); + } + + [Test] + public void Constructor_ClosingSituationNull_ThrowsArgumentNullException() + { + // Setup + var node = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); + + // Call + TestDelegate test = () => new IllustrationPointNodeSubMechanismContext(node, "", null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("closingSituation", exception.ParamName); + } + + [Test] + public void Constructor_IllustrationPointNodeInvalidType_ThrowsArgumentException() + { + // Setup + var node = new IllustrationPointNode(new TestIllustrationPoint()); + const string windDirectionName = "wdn"; + const string closingSituation = "cs"; + + // Call + TestDelegate test = () => new IllustrationPointNodeSubMechanismContext(node, windDirectionName, closingSituation); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("illustrationPointNode type has to be SubMechanismIllustrationPoint", exception.Message); + } + + [Test] + public void Constructor_ValidParameters_ExpectedProperties() + { + // Setup + var node = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); + const string windDirectionName = "wdn"; + const string closingSituation = "cs"; + + // Call + var context = new IllustrationPointNodeSubMechanismContext(node, windDirectionName, closingSituation); + + // Assert + Assert.AreSame(node, context.IllustrationPointNode); + Assert.AreEqual(windDirectionName, context.WindDirectionName); + Assert.AreEqual(closingSituation, context.ClosingSituation); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r568ff654a8a012b34937c8e6f7cd4c06ff5e3a52 -r02de9412f0e856e0ab90df7d1aeff0278b4d2f07 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 568ff654a8a012b34937c8e6f7cd4c06ff5e3a52) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 02de9412f0e856e0ab90df7d1aeff0278b4d2f07) @@ -95,6 +95,8 @@ + +