Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismSectionCreatorTest.cs =================================================================== diff -u -rce42b439da4acd8052e1a3ecf9f7d2d28fa88d7b -r15ac8c34397b5d86d718b4bc1442910e19c9d329 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismSectionCreatorTest.cs (.../SerializableFailureMechanismSectionCreatorTest.cs) (revision ce42b439da4acd8052e1a3ecf9f7d2d28fa88d7b) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismSectionCreatorTest.cs (.../SerializableFailureMechanismSectionCreatorTest.cs) (revision 15ac8c34397b5d86d718b4bc1442910e19c9d329) @@ -22,8 +22,6 @@ using System; using NUnit.Framework; using Ringtoets.AssemblyTool.IO.Model; -using Ringtoets.AssemblyTool.IO.Model.Enums; -using Ringtoets.AssemblyTool.IO.Model.Helpers; using Ringtoets.Integration.IO.Assembly; using Ringtoets.Integration.IO.Creators; using Ringtoets.Integration.IO.Helpers; @@ -51,7 +49,7 @@ public void Create_CollectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => SerializableFailureMechanismSectionCreator.Create(new UniqueIdentifierGenerator(), + TestDelegate call = () => SerializableFailureMechanismSectionCreator.Create(new UniqueIdentifierGenerator(), null, ExportableFailureMechanismSectionTestFactory.CreateExportableFailureMechanismSection()); @@ -64,7 +62,7 @@ public void Create_SectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => SerializableFailureMechanismSectionCreator.Create(new UniqueIdentifierGenerator(), + TestDelegate call = () => SerializableFailureMechanismSectionCreator.Create(new UniqueIdentifierGenerator(), new SerializableFailureMechanismSectionCollection(), null); @@ -88,16 +86,7 @@ SerializableFailureMechanismSectionCreator.Create(idGenerator, collection, section); // Assert - Assert.AreEqual("Wks.0", serializableSection.Id); - Assert.AreEqual(collection.Id, serializableSection.FailureMechanismSectionCollectionId); - - Assert.AreEqual(GeometrySerializationFormatter.Format(section.Geometry), - serializableSection.Geometry.LineString.Geometry); - Assert.AreEqual(section.StartDistance, serializableSection.StartDistance.Value); - Assert.AreEqual(section.EndDistance, serializableSection.EndDistance.Value); - Assert.AreEqual(SerializableFailureMechanismSectionType.FailureMechanism, - serializableSection.FailureMechanismSectionType); - Assert.IsNull(serializableSection.AssemblyMethod); + SerializableFailureMechanismSectionTestHelper.AssertFailureMechanismSection(section, collection, serializableSection); } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj =================================================================== diff -u -r58cc931c9371c4aaed515fdef590cfc67b5303b6 -r15ac8c34397b5d86d718b4bc1442910e19c9d329 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision 58cc931c9371c4aaed515fdef590cfc67b5303b6) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision 15ac8c34397b5d86d718b4bc1442910e19c9d329) @@ -22,6 +22,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismSectionTestHelper.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismSectionTestHelper.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismSectionTestHelper.cs (revision 15ac8c34397b5d86d718b4bc1442910e19c9d329) @@ -0,0 +1,70 @@ +// 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 NUnit.Framework; +using Ringtoets.AssemblyTool.IO.Model; +using Ringtoets.AssemblyTool.IO.Model.Enums; +using Ringtoets.AssemblyTool.IO.Model.Helpers; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.TestUtil +{ + /// + /// Helper class to assert a . + /// + public static class SerializableFailureMechanismSectionTestHelper + { + /// + /// Asserts a against + /// an . + /// + /// The to assert against. + /// The the section belongs to. + /// The to assert. + /// The expected id for the . + /// Thrown when: + /// + /// The id does not match with the expected id. + /// The id of the failure mechanism section collection does not match. + /// The geometry, start distance or the end distance of the failure mechanism section does not match. + /// The failure mechanism section type does not match. + /// The used assembly method to obtain the section does not match. + /// + /// + public static void AssertFailureMechanismSection(ExportableFailureMechanismSection expectedSection, + SerializableFailureMechanismSectionCollection expectedCollection, + SerializableFailureMechanismSection actualSerializableSection, + int expectedId = 0) + { + Assert.AreEqual($"Wks.{expectedId}", actualSerializableSection.Id); + Assert.AreEqual(expectedCollection.Id, actualSerializableSection.FailureMechanismSectionCollectionId); + + Assert.AreEqual(GeometrySerializationFormatter.Format(expectedSection.Geometry), + actualSerializableSection.Geometry.LineString.Geometry); + Assert.AreEqual(expectedSection.StartDistance, actualSerializableSection.StartDistance.Value); + Assert.AreEqual(expectedSection.EndDistance, actualSerializableSection.EndDistance.Value); + Assert.AreEqual(SerializableFailureMechanismSectionType.FailureMechanism, + actualSerializableSection.FailureMechanismSectionType); + Assert.IsNull(actualSerializableSection.AssemblyMethod); + } + + } +} \ No newline at end of file