Index: Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResult.cs =================================================================== diff -u -re442812a69b3e800977c4dde61d6f64e989ef20c -r01ff726dbaa67b9e0c19390f21121ac8e6f7c277 --- Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResult.cs (.../ArbitraryProbabilityFailureMechanismSectionResult.cs) (revision e442812a69b3e800977c4dde61d6f64e989ef20c) +++ Ringtoets/Common/src/Ringtoets.Common.Data/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResult.cs (.../ArbitraryProbabilityFailureMechanismSectionResult.cs) (revision 01ff726dbaa67b9e0c19390f21121ac8e6f7c277) @@ -37,7 +37,10 @@ /// Creates a new instance of /// /// The section for which to add the result. - public ArbitraryProbabilityFailureMechanismSectionResult(FailureMechanismSection section) : base(section) {} + public ArbitraryProbabilityFailureMechanismSectionResult(FailureMechanismSection section) : base(section) + { + AssessmentLayerTwoA = (RoundedDouble) 1.0; + } /// /// Gets the probability value of assessment layer two a. Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResultTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResultTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/ArbitraryProbabilityFailureMechanismSectionResultTest.cs (revision 01ff726dbaa67b9e0c19390f21121ac8e6f7c277) @@ -0,0 +1,105 @@ +// Copyright (C) Stichting Deltares 2016. 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.Base.Data; +using Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; + +namespace Ringtoets.Common.Data.Test.FailureMechanism +{ + [TestFixture] + public class ArbitraryProbabilityFailureMechanismSectionResultTest + { + [Test] + public void Constructor_WithoutSection_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new ArbitraryProbabilityFailureMechanismSectionResult(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("section", paramName); + } + + [Test] + public void Constructor_WithSection_ResultCreatedForSection() + { + // Setup + var section = new FailureMechanismSection("Section", new[] { new Point2D(0, 0) }); + + // Call + var result = new ArbitraryProbabilityFailureMechanismSectionResult(section); + + // Assert + Assert.IsInstanceOf(result); + Assert.AreSame(section, result.Section); + Assert.IsFalse(result.AssessmentLayerOne); + Assert.AreEqual(1, result.AssessmentLayerTwoA.Value); + Assert.AreEqual(0, result.AssessmentLayerTwoB.Value); + Assert.AreEqual(0, result.AssessmentLayerThree.Value); + } + + [Test] + [TestCase(-20)] + [TestCase(-1e-6)] + [TestCase(1+1e-6)] + [TestCase(12)] + public void AssessmentLayerTwoA_ForInvalidValues_ThrowsException(double a) + { + // Setup + var section = new FailureMechanismSection("Section", new[] { new Point2D(0, 0) }); + var result = new ArbitraryProbabilityFailureMechanismSectionResult(section); + + // Call + TestDelegate test = () => result.AssessmentLayerTwoA = (RoundedDouble)a; + + // Assert + var message = Assert.Throws(test).Message; + Assert.AreEqual( + Properties.Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentLayerTwoA_Value_needs_to_be_between_0_and_1, + message + ); + } + + [Test] + [TestCase(0)] + [TestCase(1e-6)] + [TestCase(0.5)] + [TestCase(1-1e-6)] + [TestCase(1)] + public void AssessmentLayerTwoA_ForValidValues_NewValueSet(double a) + { + // Setup + var section = new FailureMechanismSection("Section", new[] { new Point2D(0, 0) }); + var result = new ArbitraryProbabilityFailureMechanismSectionResult(section); + + var assessmentLayerTwoAValue = (RoundedDouble)a; + + // Call + result.AssessmentLayerTwoA = assessmentLayerTwoAValue; + + // Assert + Assert.AreEqual(assessmentLayerTwoAValue, result.AssessmentLayerTwoA); + } + } +} \ No newline at end of file Fisheye: Tag 01ff726dbaa67b9e0c19390f21121ac8e6f7c277 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.Test/FailureMechanism/CustomPropertyFailureMechanismSectionResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj =================================================================== diff -u -rb9d20365707e77623054f96f0c8b544e86658e67 -r01ff726dbaa67b9e0c19390f21121ac8e6f7c277 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision b9d20365707e77623054f96f0c8b544e86658e67) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 01ff726dbaa67b9e0c19390f21121ac8e6f7c277) @@ -63,7 +63,7 @@ - +