Index: Riskeer/Common/src/Riskeer.Common.Data/FailureMechanism/FailureMechanismAssemblyResultExtensions.cs =================================================================== diff -u --- Riskeer/Common/src/Riskeer.Common.Data/FailureMechanism/FailureMechanismAssemblyResultExtensions.cs (revision 0) +++ Riskeer/Common/src/Riskeer.Common.Data/FailureMechanism/FailureMechanismAssemblyResultExtensions.cs (revision 0ff2f92dfb5465fc3a8d2eda2470c04811c22d0e) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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; + +namespace Riskeer.Common.Data.FailureMechanism +{ + /// + /// Extension methods for . + /// + public static class FailureMechanismAssemblyResultExtensions + { + /// + /// Gets whether the is a manual probability. + /// + /// The to determine. + /// An indicator whether the is a manual probability. + /// Thrown when is null. + public static bool IsManualProbability(this FailurePathAssemblyResult result) + { + if (result == null) + { + throw new ArgumentNullException(nameof(result)); + } + + return result.ProbabilityResultType == FailurePathAssemblyProbabilityResultType.Manual; + } + } +} \ No newline at end of file Fisheye: Tag 0ff2f92dfb5465fc3a8d2eda2470c04811c22d0e refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Data/FailureMechanism/FailurePathAssemblyResultExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Common/test/Riskeer.Common.Data.Test/FailureMechanism/FailureMechanismAssemblyResultExtensionsTest.cs =================================================================== diff -u --- Riskeer/Common/test/Riskeer.Common.Data.Test/FailureMechanism/FailureMechanismAssemblyResultExtensionsTest.cs (revision 0) +++ Riskeer/Common/test/Riskeer.Common.Data.Test/FailureMechanism/FailureMechanismAssemblyResultExtensionsTest.cs (revision 0ff2f92dfb5465fc3a8d2eda2470c04811c22d0e) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2021. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer 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 Riskeer.Common.Data.FailureMechanism; + +namespace Riskeer.Common.Data.Test.FailureMechanism +{ + [TestFixture] + public class FailureMechanismAssemblyResultExtensionsTest + { + [Test] + public void IsManualProbability_ResultNull_ThrowsArgumentNullException() + { + // Call + void Call() => FailureMechanismAssemblyResultExtensions.IsManualProbability(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("result", exception.ParamName); + } + + [Test] + [TestCase(FailurePathAssemblyProbabilityResultType.Automatic, false)] + [TestCase(FailurePathAssemblyProbabilityResultType.Manual, true)] + public void IsManualProbability_WithFailurePathAssemblyProbabilityResultType_ReturnsExpectedResult( + FailurePathAssemblyProbabilityResultType resultType, bool expectedResult) + { + // Setup + var result = new FailurePathAssemblyResult + { + ProbabilityResultType = resultType + }; + + // Call + bool isManualProbability = result.IsManualProbability(); + + // Assert + Assert.AreEqual(expectedResult, isManualProbability); + } + } +} \ No newline at end of file Fisheye: Tag 0ff2f92dfb5465fc3a8d2eda2470c04811c22d0e refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Data.Test/FailureMechanism/FailurePathAssemblyResultExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff?