Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyMethodCreator.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyMethodCreator.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/SerializableAssemblyMethodCreator.cs (revision 2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0) @@ -0,0 +1,105 @@ +// 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 System.ComponentModel; +using Ringtoets.AssemblyTool.IO.Model.Enums; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.Creators +{ + /// + /// Creator to create . + /// + public static class SerializableAssemblyMethodCreator + { + /// + /// Creates a based on + /// . + /// + /// The + /// to create a for. + /// A . + /// Thrown when + /// is an invalid value. + /// Thrown when + /// is a valid value, but unsupported. + public static SerializableAssemblyMethod Create(ExportableAssemblyMethod assemblyMethod) + { + if (!Enum.IsDefined(typeof(ExportableAssemblyMethod), assemblyMethod)) + { + throw new InvalidEnumArgumentException(nameof(assemblyMethod), + (int) assemblyMethod, + typeof(ExportableAssemblyMethod)); + } + + switch (assemblyMethod) + { + case ExportableAssemblyMethod.WBI0E1: + return SerializableAssemblyMethod.WBI0E1; + case ExportableAssemblyMethod.WBI0E3: + return SerializableAssemblyMethod.WBI0E3; + case ExportableAssemblyMethod.WBI0G1: + return SerializableAssemblyMethod.WBI0G1; + case ExportableAssemblyMethod.WBI0G3: + return SerializableAssemblyMethod.WBI0G3; + case ExportableAssemblyMethod.WBI0G4: + return SerializableAssemblyMethod.WBI0G4; + case ExportableAssemblyMethod.WBI0G5: + return SerializableAssemblyMethod.WBI0G5; + case ExportableAssemblyMethod.WBI0G6: + return SerializableAssemblyMethod.WBI0G6; + case ExportableAssemblyMethod.WBI0T1: + return SerializableAssemblyMethod.WBI0T1; + case ExportableAssemblyMethod.WBI0T3: + return SerializableAssemblyMethod.WBI0T3; + case ExportableAssemblyMethod.WBI0T4: + return SerializableAssemblyMethod.WBI0T4; + case ExportableAssemblyMethod.WBI0T5: + return SerializableAssemblyMethod.WBI0T5; + case ExportableAssemblyMethod.WBI0T6: + return SerializableAssemblyMethod.WBI0T6; + case ExportableAssemblyMethod.WBI0T7: + return SerializableAssemblyMethod.WBI0T7; + case ExportableAssemblyMethod.WBI0A1: + return SerializableAssemblyMethod.WBI0A1; + case ExportableAssemblyMethod.WBI1A1: + return SerializableAssemblyMethod.WBI1A1; + case ExportableAssemblyMethod.WBI1B1: + return SerializableAssemblyMethod.WBI1B1; + case ExportableAssemblyMethod.WBI2A1: + return SerializableAssemblyMethod.WBI2A1; + case ExportableAssemblyMethod.WBI2B1: + return SerializableAssemblyMethod.WBI2B1; + case ExportableAssemblyMethod.WBI2C1: + return SerializableAssemblyMethod.WBI2C1; + case ExportableAssemblyMethod.WBI3A1: + return SerializableAssemblyMethod.WBI3A1; + case ExportableAssemblyMethod.WBI3B1: + return SerializableAssemblyMethod.WBI3B1; + case ExportableAssemblyMethod.WBI3C1: + return SerializableAssemblyMethod.WBI3C1; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj =================================================================== diff -u -r05be5e79657a00455e43e78b629a074290b8d89e -r2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0 --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 05be5e79657a00455e43e78b629a074290b8d89e) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0) @@ -35,6 +35,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyMethodCreatorTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyMethodCreatorTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableAssemblyMethodCreatorTest.cs (revision 2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0) @@ -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.ComponentModel; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model.Enums; +using Ringtoets.Integration.IO.Assembly; +using Ringtoets.Integration.IO.Creators; + +namespace Ringtoets.Integration.IO.Test.Creators +{ + [TestFixture] + public class SerializableAssemblyMethodCreatorTest + { + [Test] + public void Create_InvalidAssemblyMethod_ThrowInvalidEnumArgumentException() + { + // Setup + const ExportableAssemblyMethod assemblyMethod = (ExportableAssemblyMethod) 999; + + // Call + TestDelegate call = () => SerializableAssemblyMethodCreator.Create(assemblyMethod); + + // Assert + string message = $"The value of argument 'assemblyMethod' ({(int) assemblyMethod}) is invalid for Enum type '{nameof(ExportableAssemblyMethod)}'."; + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); + Assert.AreEqual("assemblyMethod", exception.ParamName); + } + + [Test] + [TestCase(ExportableAssemblyMethod.WBI0E1, SerializableAssemblyMethod.WBI0E1)] + [TestCase(ExportableAssemblyMethod.WBI0E3, SerializableAssemblyMethod.WBI0E3)] + [TestCase(ExportableAssemblyMethod.WBI0G1, SerializableAssemblyMethod.WBI0G1)] + [TestCase(ExportableAssemblyMethod.WBI0G3, SerializableAssemblyMethod.WBI0G3)] + [TestCase(ExportableAssemblyMethod.WBI0G4, SerializableAssemblyMethod.WBI0G4)] + [TestCase(ExportableAssemblyMethod.WBI0G5, SerializableAssemblyMethod.WBI0G5)] + [TestCase(ExportableAssemblyMethod.WBI0G6, SerializableAssemblyMethod.WBI0G6)] + [TestCase(ExportableAssemblyMethod.WBI0T1, SerializableAssemblyMethod.WBI0T1)] + [TestCase(ExportableAssemblyMethod.WBI0T3, SerializableAssemblyMethod.WBI0T3)] + [TestCase(ExportableAssemblyMethod.WBI0T4, SerializableAssemblyMethod.WBI0T4)] + [TestCase(ExportableAssemblyMethod.WBI0T5, SerializableAssemblyMethod.WBI0T5)] + [TestCase(ExportableAssemblyMethod.WBI0T6, SerializableAssemblyMethod.WBI0T6)] + [TestCase(ExportableAssemblyMethod.WBI0T7, SerializableAssemblyMethod.WBI0T7)] + [TestCase(ExportableAssemblyMethod.WBI0A1, SerializableAssemblyMethod.WBI0A1)] + [TestCase(ExportableAssemblyMethod.WBI1A1, SerializableAssemblyMethod.WBI1A1)] + [TestCase(ExportableAssemblyMethod.WBI1B1, SerializableAssemblyMethod.WBI1B1)] + [TestCase(ExportableAssemblyMethod.WBI2A1, SerializableAssemblyMethod.WBI2A1)] + [TestCase(ExportableAssemblyMethod.WBI2B1, SerializableAssemblyMethod.WBI2B1)] + [TestCase(ExportableAssemblyMethod.WBI2C1, SerializableAssemblyMethod.WBI2C1)] + [TestCase(ExportableAssemblyMethod.WBI3A1, SerializableAssemblyMethod.WBI3A1)] + [TestCase(ExportableAssemblyMethod.WBI3B1, SerializableAssemblyMethod.WBI3B1)] + [TestCase(ExportableAssemblyMethod.WBI3C1, SerializableAssemblyMethod.WBI3C1)] + public void Create_WithAssemblyMethod_ReturnsExpectedValues(ExportableAssemblyMethod assemblyMethod, + SerializableAssemblyMethod expectedAssemblyMethod) + { + // Call + SerializableAssemblyMethod serializableAssemblyMethod = SerializableAssemblyMethodCreator.Create(assemblyMethod); + + // Assert + Assert.AreEqual(expectedAssemblyMethod, serializableAssemblyMethod); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -r05be5e79657a00455e43e78b629a074290b8d89e -r2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 05be5e79657a00455e43e78b629a074290b8d89e) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 2e1a9648c3c88c68c7cdf3826e18c3cfedc11af0) @@ -37,6 +37,7 @@ +