Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil.Test/HeightStructuresCalculationScenarioTestFactoryTest.cs
===================================================================
diff -u
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil.Test/HeightStructuresCalculationScenarioTestFactoryTest.cs (revision 0)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil.Test/HeightStructuresCalculationScenarioTestFactoryTest.cs (revision f31ac9c417b65b2d572a51434670a7baf7c27ce8)
@@ -0,0 +1,87 @@
+// Copyright (C) Stichting Deltares 2019. 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 NUnit.Framework;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.Structures;
+using Riskeer.Common.Data.TestUtil;
+
+namespace Riskeer.HeightStructures.Data.TestUtil.Test
+{
+ [TestFixture]
+ public class HeightStructuresCalculationScenarioTestFactoryTest
+ {
+ [Test]
+ public void CreateHeightStructuresCalculationScenario_SectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => HeightStructuresCalculationScenarioTestFactory.CreateHeightStructuresCalculationScenario(null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("section", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateHeightStructuresCalculationScenario_WithSection_CreatesRelevantCalculationWithOutput()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+
+ // Call
+ StructuresCalculationScenario scenario = HeightStructuresCalculationScenarioTestFactory.CreateHeightStructuresCalculationScenario(section);
+
+ // Assert
+ Assert.IsNotNull(scenario.Output);
+ Assert.IsTrue(scenario.IsRelevant);
+ Assert.IsNotNull(scenario.InputParameters.Structure);
+ Assert.AreSame(section.StartPoint, scenario.InputParameters.Structure.Location);
+ }
+
+ [Test]
+ public void CreateNotCalculatedHeightStructuresCalculationScenario_SectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => HeightStructuresCalculationScenarioTestFactory.CreateNotCalculatedHeightStructuresCalculationScenario(null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("section", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateNotCalculatedHeightStructuresCalculationScenario_WithSection_CreatesRelevantCalculationWithoutOutput()
+ {
+ // Setup
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+
+ // Call
+ StructuresCalculationScenario scenario = HeightStructuresCalculationScenarioTestFactory.CreateNotCalculatedHeightStructuresCalculationScenario(section);
+
+ // Assert
+ Assert.IsNull(scenario.Output);
+ Assert.IsTrue(scenario.IsRelevant);
+ Assert.IsNotNull(scenario.InputParameters.Structure);
+ Assert.AreSame(section.StartPoint, scenario.InputParameters.Structure.Location);
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs
===================================================================
diff -u
--- Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs (revision 0)
+++ Riskeer/HeightStructures/test/Riskeer.HeightStructures.Data.TestUtil/HeightStructuresCalculationScenarioTestFactory.cs (revision f31ac9c417b65b2d572a51434670a7baf7c27ce8)
@@ -0,0 +1,77 @@
+// Copyright (C) Stichting Deltares 2019. 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 Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.Structures;
+using Riskeer.Common.Data.TestUtil;
+
+namespace Riskeer.HeightStructures.Data.TestUtil
+{
+ ///
+ /// Helper class for creating different instances of
+ /// for testing purposes.
+ ///
+ public static class HeightStructuresCalculationScenarioTestFactory
+ {
+ ///
+ /// Creates a calculated scenario for which the surface line on the input intersects with .
+ ///
+ /// The section for which an intersection will be created.
+ /// A new .
+ /// Thrown when is null.
+ public static StructuresCalculationScenario CreateHeightStructuresCalculationScenario(
+ FailureMechanismSection section)
+ {
+ StructuresCalculationScenario scenario = CreateNotCalculatedHeightStructuresCalculationScenario(section);
+ scenario.Output = new TestStructuresOutput();
+
+ return scenario;
+ }
+
+ ///
+ /// Creates a scenario for which the structure on the input intersects with and
+ /// the calculation has not been performed.
+ ///
+ /// The section for which an intersection will be created.
+ /// A new .
+ /// Thrown when is null.
+ public static StructuresCalculationScenario CreateNotCalculatedHeightStructuresCalculationScenario(
+ FailureMechanismSection section)
+ {
+ if (section == null)
+ {
+ throw new ArgumentNullException(nameof(section));
+ }
+
+ var scenario = new StructuresCalculationScenario
+ {
+ IsRelevant = true,
+ InputParameters =
+ {
+ Structure = new TestHeightStructure(section.StartPoint)
+ }
+ };
+
+ return scenario;
+ }
+ }
+}
\ No newline at end of file