Index: Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Calculators/Assembly/AssessmentSectionAssemblyCalculatorOld.cs =================================================================== diff -u -r8a067d513f440f079818bcec9deb1c86f8360ed6 -r8149c2c7c7024e6602c1017be03b9888ac56adf3 --- Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Calculators/Assembly/AssessmentSectionAssemblyCalculatorOld.cs (.../AssessmentSectionAssemblyCalculatorOld.cs) (revision 8a067d513f440f079818bcec9deb1c86f8360ed6) +++ Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Calculators/Assembly/AssessmentSectionAssemblyCalculatorOld.cs (.../AssessmentSectionAssemblyCalculatorOld.cs) (revision 8149c2c7c7024e6602c1017be03b9888ac56adf3) @@ -132,7 +132,7 @@ try { ICommonFailureMechanismSectionAssembler kernel = factory.CreateCombinedFailureMechanismSectionAssemblyKernel(); - AssemblyResult output = kernel.AssembleCommonFailureMechanismSections(FailureMechanismSectionListCreator.Create(input), assessmentSectionLength, false); + AssemblyResult output = kernel.AssembleCommonFailureMechanismSections(FailureMechanismSectionListCreatorOld.Create(input), assessmentSectionLength, false); return CombinedFailureMechanismSectionAssemblyCreatorOld.Create(output); } Fisheye: Tag 8149c2c7c7024e6602c1017be03b9888ac56adf3 refers to a dead (removed) revision in file `Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionListCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionListCreatorOld.cs =================================================================== diff -u --- Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionListCreatorOld.cs (revision 0) +++ Riskeer/AssemblyTool/src/Riskeer.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionListCreatorOld.cs (revision 8149c2c7c7024e6602c1017be03b9888ac56adf3) @@ -0,0 +1,66 @@ +// 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.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Assembly.Kernel.Old.Model; +using Riskeer.AssemblyTool.Data; + +namespace Riskeer.AssemblyTool.KernelWrapper.Creators +{ + /// + /// Creates instances. + /// + internal static class FailureMechanismSectionListCreatorOld + { + /// + /// Creates a collection of based on the + /// given . + /// + /// The collection of failure mechanism + /// section collections to create the failure mechanism section lists for. + /// A collection of . + /// Thrown when + /// is null. + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static IEnumerable Create( + IEnumerable> failureMechanismSectionsCollection) + { + if (failureMechanismSectionsCollection == null) + { + throw new ArgumentNullException(nameof(failureMechanismSectionsCollection)); + } + + return failureMechanismSectionsCollection.Select(sectionCollection => new FailureMechanismSectionList( + string.Empty, + sectionCollection.Select(s => new FmSectionWithDirectCategory( + s.SectionStart, s.SectionEnd, + AssemblyCalculatorInputCreatorOld.CreateFailureMechanismSectionCategory( + s.CategoryGroup))))) + .ToArray(); + } + } +} \ No newline at end of file Index: Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionListCreatorOldTest.cs =================================================================== diff -u --- Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionListCreatorOldTest.cs (revision 0) +++ Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionListCreatorOldTest.cs (revision 8149c2c7c7024e6602c1017be03b9888ac56adf3) @@ -0,0 +1,113 @@ +// 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.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Assembly.Kernel.Old.Model; +using Assembly.Kernel.Old.Model.FmSectionTypes; +using Core.Common.TestUtil; +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 FailureMechanismSectionListCreatorOldTest + { + [Test] + public void Create_FailureMechanismSectionsCollectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => FailureMechanismSectionListCreatorOld.Create(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismSectionsCollection", exception.ParamName); + } + + [Test] + public void Create_WithFailureMechanism_ReturnFailureMechanismSectionLists() + { + // Setup + var random = new Random(21); + var combinedAssemblyFailureMechanismInputs = new[] + { + new[] + { + new CombinedAssemblyFailureMechanismSectionOld(0, 1, random.NextEnumValue()), + new CombinedAssemblyFailureMechanismSectionOld(1, 2, random.NextEnumValue()) + } + }; + + // Call + IEnumerable failureMechanismSectionLists = FailureMechanismSectionListCreatorOld.Create(combinedAssemblyFailureMechanismInputs); + + // Assert + CombinedFailureMechanismSectionsInputAssert.AssertCombinedFailureMechanismInput(combinedAssemblyFailureMechanismInputs, failureMechanismSectionLists); + } + + [Test] + public void Create_InvalidGroup_ThrowsInvalidEnumArgumentException() + { + // Call + TestDelegate test = () => FailureMechanismSectionListCreatorOld.Create(new[] + { + new[] + { + new CombinedAssemblyFailureMechanismSectionOld(0, 1, (FailureMechanismSectionAssemblyCategoryGroup) 99) + } + }); + + // Assert + string expectedMessage = $"The value of argument 'category' (99) is invalid for Enum type '{nameof(FailureMechanismSectionAssemblyCategoryGroup)}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.None, EFmSectionCategory.Gr)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.NotApplicable, EFmSectionCategory.NotApplicable)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.Iv, EFmSectionCategory.Iv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.IIv, EFmSectionCategory.IIv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.IIIv, EFmSectionCategory.IIIv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.IVv, EFmSectionCategory.IVv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.Vv, EFmSectionCategory.Vv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.VIv, EFmSectionCategory.VIv)] + [TestCase(FailureMechanismSectionAssemblyCategoryGroup.VIIv, EFmSectionCategory.VIIv)] + public void Create_ValidGroup_ReturnEFmSectionCategory(FailureMechanismSectionAssemblyCategoryGroup originalGroup, EFmSectionCategory expectedGroup) + { + // Call + IEnumerable output = FailureMechanismSectionListCreatorOld.Create(new[] + { + new[] + { + new CombinedAssemblyFailureMechanismSectionOld(0, 1, originalGroup) + } + }); + + // Assert + Assert.AreEqual(expectedGroup, ((FmSectionWithDirectCategory) output.Single().Sections.Single()).Category); + } + } +} \ No newline at end of file Fisheye: Tag 8149c2c7c7024e6602c1017be03b9888ac56adf3 refers to a dead (removed) revision in file `Riskeer/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionListCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff?