Index: Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyGroupCreator.cs =================================================================== diff -u --- Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyGroupCreator.cs (revision 0) +++ Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyGroupCreator.cs (revision 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287) @@ -0,0 +1,72 @@ +// 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 Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.IO.Model.Enums; + +namespace Riskeer.Integration.IO.Creators +{ + /// + /// Creator to create . + /// + public static class SerializableAssessmentSectionAssemblyGroupCreator + { + /// + /// 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 SerializableAssessmentSectionAssemblyGroup Create(AssessmentSectionAssemblyGroup group) + { + if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyGroup), group)) + { + throw new InvalidEnumArgumentException(nameof(group), + (int) group, + typeof(AssessmentSectionAssemblyGroup)); + } + + switch (group) + { + case AssessmentSectionAssemblyGroup.NotAssessed: + return SerializableAssessmentSectionAssemblyGroup.NotAssessed; + case AssessmentSectionAssemblyGroup.APlus: + return SerializableAssessmentSectionAssemblyGroup.APlus; + case AssessmentSectionAssemblyGroup.A: + return SerializableAssessmentSectionAssemblyGroup.A; + case AssessmentSectionAssemblyGroup.B: + return SerializableAssessmentSectionAssemblyGroup.B; + case AssessmentSectionAssemblyGroup.C: + return SerializableAssessmentSectionAssemblyGroup.C; + case AssessmentSectionAssemblyGroup.D: + return SerializableAssessmentSectionAssemblyGroup.D; + default: + throw new NotSupportedException(); + } + } + } +} \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyResultCreator.cs =================================================================== diff -u -rc36b47c2e1e8cf948767cca33f80ad735f370ad0 -r1463f1e3b87f0bcf139a114b79cb7cf18d3a3287 --- Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyResultCreator.cs (.../SerializableAssessmentSectionAssemblyResultCreator.cs) (revision c36b47c2e1e8cf948767cca33f80ad735f370ad0) +++ Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionAssemblyResultCreator.cs (.../SerializableAssessmentSectionAssemblyResultCreator.cs) (revision 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287) @@ -46,7 +46,7 @@ } return new SerializableAssessmentSectionAssemblyResult(SerializableAssemblyMethodCreator.Create(result.AssemblyMethod), - SerializableAssessmentSectionCategoryGroupCreator.Create(result.AssemblyCategory)); + SerializableAssessmentSectionAssemblyGroupCreator.Create(result.AssemblyCategory)); } } } \ No newline at end of file Fisheye: Tag 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287 refers to a dead (removed) revision in file `Riskeer/Integration/src/Riskeer.Integration.IO/Creators/SerializableAssessmentSectionCategoryGroupCreator.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs =================================================================== diff -u -r888e5867fa041e62736cc23458ba908cdf95091c -r1463f1e3b87f0bcf139a114b79cb7cf18d3a3287 --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision 888e5867fa041e62736cc23458ba908cdf95091c) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287) @@ -285,7 +285,7 @@ SerializableAssessmentSectionAssemblyResult serializableAssessmentSectionAssemblyResult = serializableTotalAssembly.AssessmentSectionAssemblyResult; Assert.AreEqual(SerializableAssemblyMethodCreator.Create(expectedAssessmentSectionAssemblyResult.AssemblyMethod), serializableAssessmentSectionAssemblyResult.AssemblyMethod); - Assert.AreEqual(SerializableAssessmentSectionCategoryGroupCreator.Create(expectedAssessmentSectionAssemblyResult.AssemblyCategory), + Assert.AreEqual(SerializableAssessmentSectionAssemblyGroupCreator.Create(expectedAssessmentSectionAssemblyResult.AssemblyCategory), serializableAssessmentSectionAssemblyResult.AssemblyGroup); } Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyGroupCreatorTest.cs =================================================================== diff -u --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyGroupCreatorTest.cs (revision 0) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyGroupCreatorTest.cs (revision 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287) @@ -0,0 +1,78 @@ +// 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 Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.AssemblyTool.Data; +using Riskeer.AssemblyTool.IO.Model.Enums; +using Riskeer.Integration.IO.Creators; + +namespace Riskeer.Integration.IO.Test.Creators +{ + [TestFixture] + public class SerializableAssessmentSectionAssemblyGroupCreatorTest + { + [Test] + public void Create_InvalidAssessmentSectionAssemblyGroup_ThrowInvalidEnumArgumentException() + { + // Setup + const AssessmentSectionAssemblyGroup group = (AssessmentSectionAssemblyGroup) 999; + + // Call + void Call() => SerializableAssessmentSectionAssemblyGroupCreator.Create(group); + + // Assert + var message = $"The value of argument 'group' ({group}) is invalid for Enum type '{nameof(AssessmentSectionAssemblyGroup)}'."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, message); + } + + [Test] + [TestCase(AssessmentSectionAssemblyGroup.None)] + [TestCase(AssessmentSectionAssemblyGroup.NotApplicable)] + public void Create_WithNotSupportedAssessmentSectionAssemblyGroup_ThrowsNotSupportedException(AssessmentSectionAssemblyGroup notSupportedGroup) + { + // Call + void Call() => SerializableAssessmentSectionAssemblyGroupCreator.Create(notSupportedGroup); + + // Assert + Assert.Throws(Call); + } + + [Test] + [TestCase(AssessmentSectionAssemblyGroup.APlus, SerializableAssessmentSectionAssemblyGroup.APlus)] + [TestCase(AssessmentSectionAssemblyGroup.A, SerializableAssessmentSectionAssemblyGroup.A)] + [TestCase(AssessmentSectionAssemblyGroup.B, SerializableAssessmentSectionAssemblyGroup.B)] + [TestCase(AssessmentSectionAssemblyGroup.C, SerializableAssessmentSectionAssemblyGroup.C)] + [TestCase(AssessmentSectionAssemblyGroup.D, SerializableAssessmentSectionAssemblyGroup.D)] + [TestCase(AssessmentSectionAssemblyGroup.NotAssessed, SerializableAssessmentSectionAssemblyGroup.NotAssessed)] + public void Create_WithValidAssessmentSectionAssemblyGroup_ReturnExpectedValues(AssessmentSectionAssemblyGroup group, + SerializableAssessmentSectionAssemblyGroup expectedAssemblyGroup) + { + // Call + SerializableAssessmentSectionAssemblyGroup serializableAssemblyGroup = SerializableAssessmentSectionAssemblyGroupCreator.Create(group); + + // Assert + Assert.AreEqual(expectedAssemblyGroup, serializableAssemblyGroup); + } + } +} \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyResultCreatorTest.cs =================================================================== diff -u -r888e5867fa041e62736cc23458ba908cdf95091c -r1463f1e3b87f0bcf139a114b79cb7cf18d3a3287 --- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyResultCreatorTest.cs (.../SerializableAssessmentSectionAssemblyResultCreatorTest.cs) (revision 888e5867fa041e62736cc23458ba908cdf95091c) +++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionAssemblyResultCreatorTest.cs (.../SerializableAssessmentSectionAssemblyResultCreatorTest.cs) (revision 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287) @@ -65,7 +65,7 @@ // Assert Assert.AreEqual(SerializableAssemblyMethodCreator.Create(result.AssemblyMethod), serializableResult.AssemblyMethod); - Assert.AreEqual(SerializableAssessmentSectionCategoryGroupCreator.Create(result.AssemblyCategory), + Assert.AreEqual(SerializableAssessmentSectionAssemblyGroupCreator.Create(result.AssemblyCategory), serializableResult.AssemblyGroup); } } Fisheye: Tag 1463f1e3b87f0bcf139a114b79cb7cf18d3a3287 refers to a dead (removed) revision in file `Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssessmentSectionCategoryGroupCreatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff?