Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs =================================================================== diff -u -ra48bcdc9670ec7dc1da17ca73bb6fc1f287c39a1 -ra5a1867560f3705d7037a951c9c1a7f9e817a0a6 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision a48bcdc9670ec7dc1da17ca73bb6fc1f287c39a1) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -27,6 +27,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.Data; using Ringtoets.Integration.IO.Assembly; +using Ringtoets.Integration.IO.TestUtil; namespace Ringtoets.Integration.IO.Test.Assembly { @@ -47,8 +48,8 @@ TestDelegate call = () => new ExportableAssessmentSection(null, geometry, CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection()); @@ -70,9 +71,9 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, null, - CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + CreateAssessmentSectionAssembly(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection()); @@ -96,8 +97,8 @@ TestDelegate call = () => new ExportableAssessmentSection(string.Empty, geometry, null, - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection()); @@ -121,7 +122,7 @@ geometry, CreateAssessmentSectionAssembly(), null, - CreateFailureMechanismAssemblyResultWithoutProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection()); @@ -145,7 +146,7 @@ TestDelegate call = () => new ExportableAssessmentSection(string.Empty, geometry, CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), null, failureMechanismsWithProbability, failureMechanismsWithoutProbability, @@ -167,9 +168,9 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, geometry, - CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + CreateAssessmentSectionAssembly(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), null, failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection()); @@ -189,9 +190,9 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, geometry, - CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + CreateAssessmentSectionAssembly(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, null, CreateCombinedSectionAssemblyCollection()); @@ -214,9 +215,9 @@ // Call TestDelegate call = () => new ExportableAssessmentSection(string.Empty, geometry, - CreateAssessmentSectionAssembly(), - CreateFailureMechanismAssemblyResultWithProbability(), - CreateFailureMechanismAssemblyResultWithoutProbability(), + CreateAssessmentSectionAssembly(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(), + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), failureMechanismsWithProbability, failureMechanismsWithoutProbability, null); @@ -234,8 +235,8 @@ // Setup IEnumerable geometry = Enumerable.Empty(); ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly(); - ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability = CreateFailureMechanismAssemblyResultWithProbability(); - ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResultWithoutProbability = CreateFailureMechanismAssemblyResultWithoutProbability(); + ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability = ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(); + ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResultWithoutProbability = ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(); IEnumerable> failureMechanismsWithProbability = Enumerable.Empty>(); IEnumerable> failureMechanismsWithoutProbability = @@ -249,7 +250,8 @@ failureMechanismAssemblyResultWithProbability, failureMechanismAssemblyResultWithoutProbability, failureMechanismsWithProbability, - failureMechanismsWithoutProbability, combinedSectionAssemblyResults); + failureMechanismsWithoutProbability, + combinedSectionAssemblyResults); // Assert Assert.AreEqual(name, assessmentSection.Name); @@ -262,21 +264,6 @@ Assert.AreSame(combinedSectionAssemblyResults, assessmentSection.CombinedSectionAssemblyResults); } - private static ExportableFailureMechanismAssemblyResult CreateFailureMechanismAssemblyResultWithoutProbability() - { - var random = new Random(21); - return new ExportableFailureMechanismAssemblyResult(random.NextEnumValue(), - random.NextEnumValue()); - } - - private static ExportableFailureMechanismAssemblyResultWithProbability CreateFailureMechanismAssemblyResultWithProbability() - { - var random = new Random(21); - return new ExportableFailureMechanismAssemblyResultWithProbability(random.NextEnumValue(), - random.NextEnumValue(), - random.NextDouble()); - } - private static ExportableCombinedSectionAssemblyCollection CreateCombinedSectionAssemblyCollection() { return new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(), Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs =================================================================== diff -u -ra48bcdc9670ec7dc1da17ca73bb6fc1f287c39a1 -ra5a1867560f3705d7037a951c9c1a7f9e817a0a6 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision a48bcdc9670ec7dc1da17ca73bb6fc1f287c39a1) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -24,8 +24,8 @@ using System.Linq; using Core.Common.TestUtil; using NUnit.Framework; -using Ringtoets.AssemblyTool.Data; using Ringtoets.Integration.IO.Assembly; +using Ringtoets.Integration.IO.TestUtil; namespace Ringtoets.Integration.IO.Test.Assembly { @@ -63,7 +63,8 @@ // Call TestDelegate call = () => new ExportableFailureMechanism( - CreateFailureMechanismAssemblyResult(), null, sectionAssemblyResults, code, group); + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), + null, sectionAssemblyResults, code, group); // Assert var exception = Assert.Throws(call); @@ -81,7 +82,8 @@ // Call TestDelegate call = () => new ExportableFailureMechanism( - CreateFailureMechanismAssemblyResult(), sections, null, code, group); + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(), + sections, null, code, group); // Assert var exception = Assert.Throws(call); @@ -93,7 +95,8 @@ { // Setup var random = new Random(21); - ExportableFailureMechanismAssemblyResult failureMechanismAssembly = CreateFailureMechanismAssemblyResult(); + ExportableFailureMechanismAssemblyResult failureMechanismAssembly = + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(); IEnumerable sections = Enumerable.Empty(); IEnumerable sectionAssemblyResults = Enumerable.Empty(); @@ -111,12 +114,5 @@ Assert.AreEqual(code, failureMechanism.Code); Assert.AreEqual(group, failureMechanism.Group); } - - private static ExportableFailureMechanismAssemblyResult CreateFailureMechanismAssemblyResult() - { - var random = new Random(21); - return new ExportableFailureMechanismAssemblyResult(random.NextEnumValue(), - random.NextEnumValue()); - } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj =================================================================== diff -u -r77af63e3ae290bffd192ac96059661e15181c775 -ra5a1867560f3705d7037a951c9c1a7f9e817a0a6 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 77af63e3ae290bffd192ac96059661e15181c775) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -36,6 +36,7 @@ + @@ -83,6 +84,10 @@ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1} Ringtoets.AssemblyTool.Data + + {B9838495-B090-4B84-A387-A8974F4F9CC4} + Ringtoets.AssemblyTool.IO + {358B6DA2-A1DF-477F-B6AC-C30204265CB0} Ringtoets.AssemblyTool.KernelWrapper Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/ExportableFailureMechanismAssemblyResultTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/ExportableFailureMechanismAssemblyResultTestFactoryTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/ExportableFailureMechanismAssemblyResultTestFactoryTest.cs (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -0,0 +1,56 @@ +// 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.Data; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.TestUtil.Test +{ + [TestFixture] + public class ExportableFailureMechanismAssemblyResultTestFactoryTest + { + [Test] + public void CreateFailureMechanismAssemblyResultWithProbability_Always_ReturnsFailureMechanismAssemblyResultWithProbability() + { + // Call + ExportableFailureMechanismAssemblyResultWithProbability result = + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithProbability(); + + // Assert + Assert.AreEqual(0.75, result.Probability); + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IIt, result.AssemblyCategory); + Assert.AreEqual(ExportableAssemblyMethod.WBI1B1, result.AssemblyMethod); + } + + [Test] + public void CreateFailureMechanismAssemblyResultWithoutProbability_Always_ReturnsFailureMechanismAssemblyResultWithProbability() + { + // Call + ExportableFailureMechanismAssemblyResult result = + ExportableFailureMechanismAssemblyResultTestFactory.CreateFailureMechanismAssemblyResultWithoutProbability(); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IVt, result.AssemblyCategory); + Assert.AreEqual(ExportableAssemblyMethod.WBI1A1, result.AssemblyMethod); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/Ringtoets.Integration.IO.TestUtil.Test.csproj =================================================================== diff -u -r4552827a99f65ac03bd340be8600b9a2b01b6363 -ra5a1867560f3705d7037a951c9c1a7f9e817a0a6 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/Ringtoets.Integration.IO.TestUtil.Test.csproj (.../Ringtoets.Integration.IO.TestUtil.Test.csproj) (revision 4552827a99f65ac03bd340be8600b9a2b01b6363) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil.Test/Ringtoets.Integration.IO.TestUtil.Test.csproj (.../Ringtoets.Integration.IO.TestUtil.Test.csproj) (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -9,6 +9,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/ExportableFailureMechanismAssemblyResultTestFactory.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/ExportableFailureMechanismAssemblyResultTestFactory.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/ExportableFailureMechanismAssemblyResultTestFactory.cs (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -0,0 +1,54 @@ +// 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 Ringtoets.AssemblyTool.Data; +using Ringtoets.Integration.IO.Assembly; + +namespace Ringtoets.Integration.IO.TestUtil +{ + /// + /// Factory that creates simple instances + /// which can be used for testing. + /// + public static class ExportableFailureMechanismAssemblyResultTestFactory + { + /// + /// Creates a default instance of + /// + /// An instance of . + public static ExportableFailureMechanismAssemblyResult CreateFailureMechanismAssemblyResultWithoutProbability() + { + return new ExportableFailureMechanismAssemblyResult(ExportableAssemblyMethod.WBI1A1, + FailureMechanismAssemblyCategoryGroup.IVt); + } + + /// + /// Creates a default instance of + /// + /// An instance of . + public static ExportableFailureMechanismAssemblyResultWithProbability CreateFailureMechanismAssemblyResultWithProbability() + { + return new ExportableFailureMechanismAssemblyResultWithProbability(ExportableAssemblyMethod.WBI1B1, + FailureMechanismAssemblyCategoryGroup.IIt, + 0.75); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj =================================================================== diff -u -rf5292d182348de2ddb7760b7e3f27b0f9cfc9177 -ra5a1867560f3705d7037a951c9c1a7f9e817a0a6 --- Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision f5292d182348de2ddb7760b7e3f27b0f9cfc9177) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.TestUtil/Ringtoets.Integration.IO.TestUtil.csproj (.../Ringtoets.Integration.IO.TestUtil.csproj) (revision a5a1867560f3705d7037a951c9c1a7f9e817a0a6) @@ -18,6 +18,7 @@ +