Fisheye: Tag 50a62edbe5db7e54dadeaa7d005eed6a8e77b642 refers to a dead (removed) revision in file `Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyResultCreator.cs =================================================================== diff -u --- Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyResultCreator.cs (revision 0) +++ Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/AssessmentSectionAssemblyResultCreator.cs (revision 8e00cdca05f9cccf95410f8e592643a5a1c3525b) @@ -0,0 +1,56 @@ +// 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 System.ComponentModel; +using Assembly.Kernel.Model.AssessmentSection; +using Assembly.Kernel.Model.Categories; +using Riskeer.AssemblyTool.Data; + +namespace Riskeer.AssemblyTool.KernelWrapper.Creators +{ + /// + /// Creates instances. + /// + public static class AssessmentSectionAssemblyResultCreator + { + /// + /// Converts an into a . + /// + /// The to convert. + /// A based on . + /// Thrown when is null. + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static AssessmentSectionAssemblyResult CreateAssessmentSectionAssemblyResult(AssessmentSectionResult result) + { + if (result == null) + { + throw new ArgumentNullException(nameof(result)); + } + + return new AssessmentSectionAssemblyResult(result.FailureProbability, + AssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategory(result.Category)); + } + } +} \ No newline at end of file Fisheye: Tag 50a62edbe5db7e54dadeaa7d005eed6a8e77b642 refers to a dead (removed) revision in file `Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyResultCreatorTest.cs =================================================================== diff -u --- Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyResultCreatorTest.cs (revision 0) +++ Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/AssessmentSectionAssemblyResultCreatorTest.cs (revision 8e00cdca05f9cccf95410f8e592643a5a1c3525b) @@ -0,0 +1,67 @@ +// 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 Assembly.Kernel.Model; +using Assembly.Kernel.Model.AssessmentSection; +using Assembly.Kernel.Model.Categories; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.KernelWrapper.Creators; +using Riskeer.AssemblyTool.KernelWrapper.TestUtil; + +namespace Riskeer.AssemblyTool.KernelWrapper.Test.Creators +{ + [TestFixture] + public class AssessmentSectionAssemblyResultCreatorTest + { + [Test] + public void CreateAssessmentSectionAssemblyResult_ResultNull_ThrowsArgumentNullException() + { + // Call + void Call() => AssessmentSectionAssemblyResultCreator.CreateAssessmentSectionAssemblyResult(null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("result", exception.ParamName); + } + + [Test] + [TestCaseSource(typeof(AssessmentGradeConversionTestHelper), nameof(AssessmentGradeConversionTestHelper.AssessmentGradeConversionCases))] + public void CreateAssessmentSectionAssemblyResult_WithResult_ReturnsExpectedResult( + EAssessmentGrade categoryGroup, + AssessmentSectionAssemblyCategoryGroup expectedCategoryGroup) + { + // Setup + var random = new Random(21); + double probability = random.NextDouble(); + var result = new AssessmentSectionResult(new Probability(probability), categoryGroup); + + // Call + AssessmentSectionAssemblyResult createdResult = + AssessmentSectionAssemblyResultCreator.CreateAssessmentSectionAssemblyResult(result); + + // Assert + Assert.AreEqual(probability, createdResult.Probability); + Assert.AreEqual(expectedCategoryGroup, createdResult.AssemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs =================================================================== diff -u -r86db41f54622d8d64a9e70cd96ae8a4198de4703 -r8e00cdca05f9cccf95410f8e592643a5a1c3525b --- Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs (.../AssessmentGradeConversionTestHelper.cs) (revision 86db41f54622d8d64a9e70cd96ae8a4198de4703) +++ Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs (.../AssessmentGradeConversionTestHelper.cs) (revision 8e00cdca05f9cccf95410f8e592643a5a1c3525b) @@ -20,7 +20,7 @@ // All rights reserved. using System.Collections.Generic; -using Assembly.Kernel.Old.Model; +using Assembly.Kernel.Model.Categories; using NUnit.Framework; using Riskeer.AssemblyTool.Data; @@ -35,7 +35,7 @@ /// Gets a collection of test cases to test the conversion between /// and . /// - public static IEnumerable AsssementGradeConversionCases + public static IEnumerable AssessmentGradeConversionCases { get {