Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismResultCreatorTest.cs
===================================================================
diff -u -r66867c059a3d1c4846828871cdf6d354b2b608a6 -r58cc931c9371c4aaed515fdef590cfc67b5303b6
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismResultCreatorTest.cs (.../SerializableFailureMechanismResultCreatorTest.cs) (revision 66867c059a3d1c4846828871cdf6d354b2b608a6)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/SerializableFailureMechanismResultCreatorTest.cs (.../SerializableFailureMechanismResultCreatorTest.cs) (revision 58cc931c9371c4aaed515fdef590cfc67b5303b6)
@@ -26,6 +26,7 @@
using Ringtoets.AssemblyTool.IO.Model.DataTypes;
using Ringtoets.Integration.IO.Assembly;
using Ringtoets.Integration.IO.Creators;
+using Ringtoets.Integration.IO.TestUtil;
namespace Ringtoets.Integration.IO.Test.Creators
{
@@ -55,9 +56,7 @@
SerializableFailureMechanismAssemblyResult serializableAssemblyResult = SerializableFailureMechanismResultCreator.Create(result);
// Assert
- Assert.AreEqual(SerializableFailureMechanismCategoryGroupCreator.Create(result.AssemblyCategory), serializableAssemblyResult.CategoryGroup);
- Assert.AreEqual(SerializableAssemblyMethodCreator.Create(result.AssemblyMethod), serializableAssemblyResult.AssemblyMethod);
- Assert.IsNull(serializableAssemblyResult.Probability);
+ SerializableFailureMechanismAssemblyResultTestHelper.AssertSerializableFailureMechanismAssemblyResult(result, serializableAssemblyResult);
}
[Test]
@@ -87,9 +86,7 @@
SerializableFailureMechanismAssemblyResult serializableAssemblyResult = SerializableFailureMechanismResultCreator.Create(result);
// Assert
- Assert.AreEqual(SerializableFailureMechanismCategoryGroupCreator.Create(result.AssemblyCategory), serializableAssemblyResult.CategoryGroup);
- Assert.AreEqual(SerializableAssemblyMethodCreator.Create(result.AssemblyMethod), serializableAssemblyResult.AssemblyMethod);
- Assert.AreEqual(result.Probability, serializableAssemblyResult.Probability);
+ SerializableFailureMechanismAssemblyResultTestHelper.AssertSerializableFailureMechanismAssemblyResult(result, serializableAssemblyResult);
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj
===================================================================
diff -u -r30c0356e486b018532e85b0dde94efe832cf445f -r58cc931c9371c4aaed515fdef590cfc67b5303b6
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision 30c0356e486b018532e85b0dde94efe832cf445f)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision 58cc931c9371c4aaed515fdef590cfc67b5303b6)
@@ -21,6 +21,7 @@
+
@@ -37,6 +38,10 @@
{420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
Ringtoets.AssemblyTool.Data
+
+ {B9838495-B090-4B84-A387-A8974F4F9CC4}
+ Ringtoets.AssemblyTool.IO
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismAssemblyResultTestHelper.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismAssemblyResultTestHelper.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/SerializableFailureMechanismAssemblyResultTestHelper.cs (revision 58cc931c9371c4aaed515fdef590cfc67b5303b6)
@@ -0,0 +1,79 @@
+// 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.DataTypes;
+using Ringtoets.Integration.IO.Assembly;
+using Ringtoets.Integration.IO.Creators;
+
+namespace Ringtoets.Integration.IO.TestUtil
+{
+ ///
+ /// Helper class to assert a
+ ///
+ public static class SerializableFailureMechanismAssemblyResultTestHelper
+ {
+ ///
+ /// Asserts a against an
+ /// .
+ ///
+ /// The to assert against.
+ /// The to assert.
+ /// Thrown when:
+ ///
+ /// - The assembly methods do not match,
+ /// - The failure mechanism category group assembly results do not match,
+ /// - The probability of has a value.
+ ///
+ public static void AssertSerializableFailureMechanismAssemblyResult(ExportableFailureMechanismAssemblyResult expectedResult,
+ SerializableFailureMechanismAssemblyResult actualResult)
+ {
+ AssertSerializableBaseProperties(expectedResult, actualResult);
+ Assert.IsNull(actualResult.Probability);
+ }
+
+ ///
+ /// Asserts a against an
+ /// .
+ ///
+ /// The to assert against.
+ /// The to assert.
+ /// Thrown when:
+ ///
+ /// - The assembly methods do not match,
+ /// - The failure mechanism category group assembly results do not match,
+ /// - The probabilities do not match.
+ ///
+ public static void AssertSerializableFailureMechanismAssemblyResult(ExportableFailureMechanismAssemblyResultWithProbability expectedResult,
+ SerializableFailureMechanismAssemblyResult actualResult)
+ {
+ AssertSerializableBaseProperties(expectedResult, actualResult);
+ Assert.AreEqual(expectedResult.Probability, actualResult.Probability);
+ }
+
+ private static void AssertSerializableBaseProperties(ExportableFailureMechanismAssemblyResult expectedResult,
+ SerializableFailureMechanismAssemblyResult actualResult)
+ {
+ Assert.AreEqual(SerializableFailureMechanismCategoryGroupCreator.Create(expectedResult.AssemblyCategory), actualResult.CategoryGroup);
+ Assert.AreEqual(SerializableAssemblyMethodCreator.Create(expectedResult.AssemblyMethod), actualResult.AssemblyMethod);
+ }
+ }
+}
\ No newline at end of file