Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreator.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreator.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreator.cs (revision cb6212fd6cb39079fd0c0390522b0776ad40997f) @@ -0,0 +1,53 @@ +// 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.AssemblyTool.IO.Model.DataTypes; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.Creators +{ + /// + /// Creator to create instances of . + /// + public static class SerializableCombinedFailureMechanismSectionAssemblyResultCreator + { + /// + /// Creates an instance of . + /// + /// The + /// to create a for. + /// A . + /// Thrown when is null. + public static SerializableCombinedFailureMechanismSectionAssemblyResult Create(ExportableFailureMechanismCombinedSectionAssemblyResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException(nameof(sectionResult)); + } + + ExportableSectionAssemblyResult sectionResultSectionAssemblyResult = sectionResult.SectionAssemblyResult; + return new SerializableCombinedFailureMechanismSectionAssemblyResult(SerializableAssemblyMethodCreator.Create(sectionResultSectionAssemblyResult.AssemblyMethod), + SerializableFailureMechanismTypeCreator.Create(sectionResult.Code), + SerializableFailureMechanismSectionCategoryGroupCreator.Create(sectionResultSectionAssemblyResult.AssemblyCategory)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -rd4657b4682a9dc5744969a848413db91b31cfc2f -rcb6212fd6cb39079fd0c0390522b0776ad40997f --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision d4657b4682a9dc5744969a848413db91b31cfc2f) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision cb6212fd6cb39079fd0c0390522b0776ad40997f) @@ -44,6 +44,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs (revision cb6212fd6cb39079fd0c0390522b0776ad40997f) @@ -0,0 +1,82 @@ +// 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 Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.IO.Model.DataTypes; +using Ringtoets.Integration.IO.Assembly; +using Ringtoets.Integration.IO.Creators; + +namespace Ringtoets.Integration.IO.Test.Creators +{ + [TestFixture] + public class SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest + { + [Test] + public void Create_SectionResultNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("sectionResult", exception.ParamName); + } + + [Test] + public void Create_WithSectionAssembly_ReturnsSerializableCombinedFailureMechanismSectionAssemblyResult() + { + // Setup + var random = new Random(21); + var sectionResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(CreateSectionAssemblyResult(), + random.NextEnumValue()); + + // Call + SerializableCombinedFailureMechanismSectionAssemblyResult serializableResult = + SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(sectionResult); + + // Assert + Assert.AreEqual(SerializableFailureMechanismTypeCreator.Create(sectionResult.Code), + serializableResult.FailureMechanismType); + + ExportableSectionAssemblyResult expectedSectionAssemblyResult = sectionResult.SectionAssemblyResult; + Assert.AreEqual(SerializableAssemblyMethodCreator.Create(expectedSectionAssemblyResult.AssemblyMethod), + serializableResult.AssemblyMethod); + Assert.AreEqual(SerializableFailureMechanismSectionCategoryGroupCreator.Create(expectedSectionAssemblyResult.AssemblyCategory), + serializableResult.CategoryGroup); + } + + private static ExportableSectionAssemblyResult CreateSectionAssemblyResult() + { + var random = new Random(21); + var assemblyCategoryGroup = random.NextEnumValue(); + if (assemblyCategoryGroup == FailureMechanismSectionAssemblyCategoryGroup.None) + { + assemblyCategoryGroup = FailureMechanismSectionAssemblyCategoryGroup.IIIv; + } + + return new ExportableSectionAssemblyResult(random.NextEnumValue(), + assemblyCategoryGroup); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -rd4657b4682a9dc5744969a848413db91b31cfc2f -rcb6212fd6cb39079fd0c0390522b0776ad40997f --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision d4657b4682a9dc5744969a848413db91b31cfc2f) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision cb6212fd6cb39079fd0c0390522b0776ad40997f) @@ -1,4 +1,4 @@ - + {06C448C6-CBDE-4579-B5B6-1B8074E022ED} @@ -46,6 +46,7 @@ +