Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -ra9cf6a3db67261dde6cb645b4f46ca23431d0416 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision a9cf6a3db67261dde6cb645b4f46ca23431d0416) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -104,8 +104,8 @@ [Test] public void GivenFailureMechanismResultsView_WhenAllDataSet_ThenDataGridViewCorrectlyInitialized() { - // Given - using (CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism())) + // Given & When + using (CreateConfiguredFailureMechanismResultsView()) { // Then var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -139,7 +139,7 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Setup - using (CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism())) + using (CreateConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -208,35 +208,21 @@ public void FailureMechanismResultView_WithClosingStructuresFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new ClosingStructuresFailureMechanismSectionResult(section1) + var result1 = new ClosingStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new ClosingStructuresFailureMechanismSectionResult(section2) + var result2 = new ClosingStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new ClosingStructuresFailureMechanismSectionResult(section3) + var result3 = new ClosingStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerThree = random.NextRoundedDouble() @@ -355,12 +341,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new ClosingStructuresFailureMechanismSectionResult(section) + var result = new ClosingStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerThree = random.NextRoundedDouble() @@ -394,7 +377,7 @@ public void GivenSectionResultWithoutCalculation_ThenLayerTwoAErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult }; @@ -426,7 +409,7 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation(), SimpleAssessmentResult = simpleAssessmentResult @@ -457,7 +440,7 @@ public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -492,7 +475,7 @@ public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -552,7 +535,7 @@ AssessmentLayerOneState assessmentLayerOneState) { // Given - var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -595,7 +578,7 @@ public void FailureMechanismResultView_EditValueInvalid_ShowsErrorTooltip(string newValue, int cellIndex) { // Setup - using (CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism())) + using (CreateConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -616,7 +599,7 @@ public void FailureMechanismResultView_EditValueAssessmentLayerThreeInvalid_ShowErrorToolTip(double newValue) { // Setup - using (CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism())) + using (CreateConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -654,7 +637,7 @@ private static IEnumerable GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage() { - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) { @@ -709,13 +692,9 @@ }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultNotApplicable"); } - private static FailureMechanismSection CreateSimpleFailureMechanismSection() + private ClosingStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView() { - return FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); + return CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism()); } private ClosingStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView( Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionResultTestFactoryTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionResultTestFactoryTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionResultTestFactoryTest.cs (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -0,0 +1,47 @@ +// 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 Core.Common.Base.Geometry; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; + +namespace Ringtoets.Common.Data.TestUtil.Test +{ + [TestFixture] + public class FailureMechanismSectionResultTestFactoryTest + { + [Test] + public void CreateFailureMechanismSectionResult_ReturnsExpectedValues() + { + // Call + TestFailureMechanismSectionResult sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); + + // Assert + Assert.AreEqual(AssessmentLayerOneState.NotAssessed, sectionResult.AssessmentLayerOne); + Assert.AreEqual("test", sectionResult.Section.Name); + CollectionAssert.AreEqual(new[] + { + new Point2D(0, 0), + new Point2D(1, 0) + }, sectionResult.Section.Points); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionTestFactoryTest.cs =================================================================== diff -u -r59a50f143a03c69f2ddca17d8eb26d1b0b148876 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionTestFactoryTest.cs (.../FailureMechanismSectionTestFactoryTest.cs) (revision 59a50f143a03c69f2ddca17d8eb26d1b0b148876) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/FailureMechanismSectionTestFactoryTest.cs (.../FailureMechanismSectionTestFactoryTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Collections.Generic; using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; @@ -30,7 +31,7 @@ public class FailureMechanismSectionTestFactoryTest { [Test] - public void CreateFailureMechanismSection_ReturnsExpectedValues() + public void CreateFailureMechanismSection_DefaultName_ReturnsExpectedValues() { // Call FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); @@ -46,10 +47,26 @@ } [Test] + public void CreateFailureMechanismSection_WithName_ReturnsExpectedValues() + { + // Call + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection("section ABC"); + + // Assert + Assert.IsNotNull(section); + Assert.AreEqual("section ABC", section.Name); + CollectionAssert.AreEqual(new[] + { + new Point2D(0, 0), + new Point2D(1, 0) + }, section.Points); + } + + [Test] public void CreateFailureMechanismSection_CoordinatesNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => FailureMechanismSectionTestFactory.CreateFailureMechanismSection(null); + TestDelegate call = () => FailureMechanismSectionTestFactory.CreateFailureMechanismSection((IEnumerable) null); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj =================================================================== diff -u -r4e9d3556e3cee0365fc0f26d0bad19b50594e12d -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 4e9d3556e3cee0365fc0f26d0bad19b50594e12d) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,6 +22,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionResultTestFactory.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionResultTestFactory.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionResultTestFactory.cs (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -0,0 +1,41 @@ +// 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.Common.Data.FailureMechanism; + +namespace Ringtoets.Common.Data.TestUtil +{ + /// + /// Factory for creating a valid which can + /// be used for testing. + /// + public static class FailureMechanismSectionResultTestFactory + { + /// + /// Creates a default . + /// + /// A valid . + public static TestFailureMechanismSectionResult CreateFailureMechanismSectionResult() + { + return new TestFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionTestFactory.cs =================================================================== diff -u -r59a50f143a03c69f2ddca17d8eb26d1b0b148876 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionTestFactory.cs (.../FailureMechanismSectionTestFactory.cs) (revision 59a50f143a03c69f2ddca17d8eb26d1b0b148876) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/FailureMechanismSectionTestFactory.cs (.../FailureMechanismSectionTestFactory.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -33,12 +33,13 @@ public static class FailureMechanismSectionTestFactory { /// - /// Creates a default . + /// Creates a . /// + /// The (optional) name of the section. /// A valid . - public static FailureMechanismSection CreateFailureMechanismSection() + public static FailureMechanismSection CreateFailureMechanismSection(string name = "test") { - return CreateFailureMechanismSection(new[] + return CreateFailureMechanismSection(name, new[] { new Point2D(0, 0), new Point2D(1, 0) @@ -64,7 +65,12 @@ throw new ArgumentNullException(nameof(coordinates)); } - return new FailureMechanismSection("test", coordinates); + return CreateFailureMechanismSection("test", coordinates); } + + private static FailureMechanismSection CreateFailureMechanismSection(string name, IEnumerable coordinates) + { + return new FailureMechanismSection(name, coordinates); + } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj =================================================================== diff -u -r4e9d3556e3cee0365fc0f26d0bad19b50594e12d -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 4e9d3556e3cee0365fc0f26d0bad19b50594e12d) +++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -28,6 +28,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs =================================================================== diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismResultViewTest.cs (.../FailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,14 +22,12 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.Controls.Views; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; -using Ringtoets.Common.Primitives; namespace Ringtoets.Common.Forms.Test.Views { @@ -109,10 +107,7 @@ Assert.AreEqual(0, dataGridView.RowCount); // When - sectionResults.Add(new TestFailureMechanismSectionResult(new FailureMechanismSection("a", new[] - { - new Point2D(0, 0) - }))); + sectionResults.Add(FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult()); sectionResults.NotifyObservers(); // Then @@ -124,13 +119,8 @@ public void GivenFailureMechanismResultView_WhenSingleFailureMechanismSectionResultNotifiesObservers_ThenCellFormattingEventFired() { // Given - var sectionResult = new TestFailureMechanismSectionResult(new FailureMechanismSection("a", new[] - { - new Point2D(0, 0) - })) - { - AssessmentLayerOne = AssessmentLayerOneState.NoVerdict - }; + TestFailureMechanismSectionResult sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); + var sectionResults = new ObservableList { sectionResult @@ -162,7 +152,8 @@ public class TestFailureMechanismResultView : FailureMechanismResultView { - public TestFailureMechanismResultView(IObservableEnumerable failureMechanismSectionResults, TestFailureMechanism failureMechanism) + public TestFailureMechanismResultView(IObservableEnumerable failureMechanismSectionResults, + TestFailureMechanism failureMechanism) : base(failureMechanismSectionResults, failureMechanism) { UpdateDataGridViewDataSource(); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r758ce737a65c6a90b92ef8446aa911ced6d7b21a -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs (.../FailureMechanismSectionResultRowTest.cs) (revision 758ce737a65c6a90b92ef8446aa911ced6d7b21a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismSectionResultRowTest.cs (.../FailureMechanismSectionResultRowTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -20,10 +20,7 @@ // All rights reserved. using System; -using Core.Common.Base; using NUnit.Framework; -using Rhino.Mocks; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; @@ -47,14 +44,13 @@ public void Constructor_WithParameters_ExpectedValues() { // Setup - FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); - var result = new TestFailureMechanismSectionResult(section); + TestFailureMechanismSectionResult sectionResult = FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); // Call - var row = new TestFailureMechanismSectionResultRow(result); + var row = new TestFailureMechanismSectionResultRow(sectionResult); // Assert - Assert.AreEqual(section.Name, row.Name); + Assert.AreEqual(sectionResult.Section.Name, row.Name); } } Index: Ringtoets/Common/test/Ringtoets.Common.Util.Test/SectionResultWithCalculationAssignmentTest.cs =================================================================== diff -u -rfcad48d7beb394e1ac15cfe4289a7381e05aa883 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Common/test/Ringtoets.Common.Util.Test/SectionResultWithCalculationAssignmentTest.cs (.../SectionResultWithCalculationAssignmentTest.cs) (revision fcad48d7beb394e1ac15cfe4289a7381e05aa883) +++ Ringtoets/Common/test/Ringtoets.Common.Util.Test/SectionResultWithCalculationAssignmentTest.cs (.../SectionResultWithCalculationAssignmentTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -20,9 +20,8 @@ // All rights reserved. using System; -using Core.Common.Base.Geometry; using NUnit.Framework; -using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; namespace Ringtoets.Common.Util.Test { @@ -44,7 +43,8 @@ public void Constructor_GetCalculationActionIsNull_ThrowsArgumentNullException() { // Setup - var failureMechanismSectionResult = new TestFailureMechanismSectionResult(); + TestFailureMechanismSectionResult failureMechanismSectionResult = + FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); // Call TestDelegate test = () => new SectionResultWithCalculationAssignment(failureMechanismSectionResult, @@ -59,7 +59,8 @@ public void Constructor_SetCalculationActionIsNull_ThrowsArgumentNullException() { // Setup - var failureMechanismSectionResult = new TestFailureMechanismSectionResult(); + TestFailureMechanismSectionResult failureMechanismSectionResult = + FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); // Call TestDelegate test = () => new SectionResultWithCalculationAssignment(failureMechanismSectionResult, @@ -74,7 +75,8 @@ public void Constructor_ValidParameters_ExpectedValues() { // Setup - var failureMechanismSectionResult = new TestFailureMechanismSectionResult(); + TestFailureMechanismSectionResult failureMechanismSectionResult = + FailureMechanismSectionResultTestFactory.CreateFailureMechanismSectionResult(); // Call var sectionResultWithCalculationAssignment = new SectionResultWithCalculationAssignment(failureMechanismSectionResult, @@ -83,13 +85,5 @@ // Assert Assert.AreSame(failureMechanismSectionResult, sectionResultWithCalculationAssignment.Result); } - - private class TestFailureMechanismSectionResult : FailureMechanismSectionResult - { - public TestFailureMechanismSectionResult() : base(new FailureMechanismSection("", new[] - { - new Point2D(1.1, 2.2) - })) {} - } } } \ No newline at end of file Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs =================================================================== diff -u -r7e64235010367ff8791434dfb717150e8f52e3ba -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs (.../DuneErosionFailureMechanismResultViewTest.cs) (revision 7e64235010367ff8791434dfb717150e8f52e3ba) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneErosionFailureMechanismResultViewTest.cs (.../DuneErosionFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.DuneErosion.Data; @@ -94,33 +94,23 @@ public void DuneErosionFailureMechanismResultView_WithDuneErosionFailureMechanismSectionResult_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new DuneErosionFailureMechanismSectionResult(section1) + var result1 = new DuneErosionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new DuneErosionFailureMechanismSectionResult(section2) + var result2 = new DuneErosionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new DuneErosionFailureMechanismSectionResult(section3) + var result3 = new DuneErosionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.Applicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -r274161d489130ce04e335145752e70e0e6be0f6a -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 274161d489130ce04e335145752e70e0e6be0f6a) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -129,7 +129,7 @@ public void FailureMechanismResultsView_AllDataSet_DataGridViewCorrectlyInitialized() { // Setup & Call - using (ShowFullyConfiguredFailureMechanismResultsView(new GrassCoverErosionInwardsFailureMechanism())) + using (ShowFullyConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -162,7 +162,7 @@ SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Setup - using (ShowFullyConfiguredFailureMechanismResultsView(new GrassCoverErosionInwardsFailureMechanism())) + using (ShowFullyConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -207,7 +207,7 @@ public void FailureMechanismResultView_EditValueInvalid_ShowsErrorTooltip(string newValue, int cellIndex) { // Setup - using (ShowFullyConfiguredFailureMechanismResultsView(new GrassCoverErosionInwardsFailureMechanism())) + using (ShowFullyConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -228,7 +228,7 @@ public void FailureMechanismResultView_EditValueAssessmentLayerThreeInvalid_ShowErrorToolTip(double newValue) { // Setup - using (ShowFullyConfiguredFailureMechanismResultsView(new GrassCoverErosionInwardsFailureMechanism())) + using (ShowFullyConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; @@ -270,7 +270,7 @@ public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult }; @@ -302,7 +302,7 @@ SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new GrassCoverErosionInwardsCalculation(), SimpleAssessmentResult = simpleAssessmentResult @@ -340,7 +340,7 @@ new TestDikeHeightOutput(double.NaN), new TestOvertoppingRateOutput(double.NaN)) }; - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(section) { Calculation = calculation, @@ -373,7 +373,7 @@ public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new GrassCoverErosionInwardsCalculation { @@ -436,7 +436,7 @@ SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new GrassCoverErosionInwardsCalculation { @@ -480,7 +480,7 @@ private static IEnumerable SimpleAssessmentResultIsSufficientVariousSectionResults() { - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); const double reliability = 0.56789; yield return new TestCaseData(new GrassCoverErosionInwardsFailureMechanismSectionResult(section) @@ -514,15 +514,9 @@ }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutput"); } - private static FailureMechanismSection CreateSimpleFailureMechanismSection() + private GrassCoverErosionInwardsFailureMechanismResultView ShowFullyConfiguredFailureMechanismResultsView() { - var section = new FailureMechanismSection("A", - new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - return section; + return ShowFullyConfiguredFailureMechanismResultsView(new GrassCoverErosionInwardsFailureMechanism()); } private GrassCoverErosionInwardsFailureMechanismResultView ShowFullyConfiguredFailureMechanismResultsView( Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -r80cc77ed4382e822d305dbef5b8ac604d61ea02a -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs) (revision 80cc77ed4382e822d305dbef5b8ac604d61ea02a) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -95,43 +95,30 @@ public void GrassCoverErosionOutwardsFailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section1) + var result1 = new GrassCoverErosionOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section2) + var result2 = new GrassCoverErosionOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section3) + var result3 = new GrassCoverErosionOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new GrassCoverErosionOutwardsFailureMechanismSectionResult(section4) + var result4 = new GrassCoverErosionOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -208,11 +195,9 @@ { // Given var random = new Random(21); - var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new FailureMechanismSection("Section 1", new[] + var result = new GrassCoverErosionOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { - new Point2D(0, 0) - })) - { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -ra9cf6a3db67261dde6cb645b4f46ca23431d0416 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision a9cf6a3db67261dde6cb645b4f46ca23431d0416) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -457,7 +457,7 @@ public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult }; @@ -487,7 +487,7 @@ public void GivenSectionResultAndCalculationNotCalculated_ThenDetailedAssessmentErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation(), SimpleAssessmentResult = simpleAssessmentResult @@ -523,7 +523,7 @@ { Output = new TestStructuresOutput(double.NaN) }; - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); var sectionResult = new HeightStructuresFailureMechanismSectionResult(section) { Calculation = calculation, @@ -556,7 +556,7 @@ public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(SimpleAssessmentResultType simpleAssessmentResult) { // Given - var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -618,7 +618,7 @@ AssessmentLayerOneState assessmentLayerOneState) { // Given - var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -657,7 +657,7 @@ private static IEnumerable GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage() { - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) { @@ -712,15 +712,6 @@ }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultNotApplicable"); } - private static FailureMechanismSection CreateSimpleFailureMechanismSection() - { - return FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - } - private HeightStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView(HeightStructuresFailureMechanism failureMechanism) { failureMechanism.AddSection(new FailureMechanismSection("Section 1", new List Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffInwardsResultViewTest.cs (.../GrassCoverSlipOffInwardsResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -95,43 +95,30 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(section1) + var result1 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(section2) + var result2 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(section3) + var result3 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(section4) + var result4 = new GrassCoverSlipOffInwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -208,11 +195,9 @@ { // Given var random = new Random(21); - var result = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new FailureMechanismSection("Section 1", new[] + var result = new GrassCoverSlipOffInwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { - new Point2D(0, 0) - })) - { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs (.../GrassCoverSlipOffOutwardsResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultViewTest.cs (.../GrassCoverSlipOffOutwardsResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -95,43 +95,30 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section1) + var result1 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section2) + var result2 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section3) + var result3 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section4) + var result4 = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -207,12 +194,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(section) + var result = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MacrostabilityOutwardsResultViewTest.cs (.../MacrostabilityOutwardsResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,10 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; -using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; @@ -94,43 +93,30 @@ public void FailureMechanismResultView_FailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new MacroStabilityOutwardsFailureMechanismSectionResult(section1) + var result1 = new MacroStabilityOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = random.NextRoundedDouble(), AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new MacroStabilityOutwardsFailureMechanismSectionResult(section2) + var result2 = new MacroStabilityOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = random.NextRoundedDouble(), AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new MacroStabilityOutwardsFailureMechanismSectionResult(section3) + var result3 = new MacroStabilityOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = random.NextRoundedDouble(), AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new MacroStabilityOutwardsFailureMechanismSectionResult(section4) + var result4 = new MacroStabilityOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = random.NextRoundedDouble(), @@ -210,11 +196,9 @@ { // Given var random = new Random(21); - var result = new MacroStabilityOutwardsFailureMechanismSectionResult(new FailureMechanismSection("Section 1", new[] + var result = new MacroStabilityOutwardsFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { - new Point2D(0, 0) - })) - { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = random.NextRoundedDouble(), AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/MicrostabilityResultViewTest.cs (.../MicrostabilityResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -95,43 +95,30 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new MicrostabilityFailureMechanismSectionResult(section1) + var result1 = new MicrostabilityFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new MicrostabilityFailureMechanismSectionResult(section2) + var result2 = new MicrostabilityFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new MicrostabilityFailureMechanismSectionResult(section3) + var result3 = new MicrostabilityFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new MicrostabilityFailureMechanismSectionResult(section4) + var result4 = new MicrostabilityFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -207,12 +194,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new MicrostabilityFailureMechanismSectionResult(section) + var result = new MicrostabilityFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs (.../PipingStructureResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/PipingStructureResultViewTest.cs (.../PipingStructureResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -95,43 +95,30 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new PipingStructureFailureMechanismSectionResult(section1) + var result1 = new PipingStructureFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new PipingStructureFailureMechanismSectionResult(section2) + var result2 = new PipingStructureFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new PipingStructureFailureMechanismSectionResult(section3) + var result3 = new PipingStructureFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new PipingStructureFailureMechanismSectionResult(section4) + var result4 = new PipingStructureFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -207,12 +194,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new PipingStructureFailureMechanismSectionResult(section) + var result = new PipingStructureFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultViewTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,10 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; -using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -91,40 +90,27 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(section1) + var result1 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(section2) + var result2 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(section3) + var result3 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(section4) + var result4 = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerThree = random.NextRoundedDouble() @@ -191,12 +177,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(section) + var result = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/TechnicalInnovationResultViewTest.cs (.../TechnicalInnovationResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,10 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; -using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -92,40 +91,27 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new TechnicalInnovationFailureMechanismSectionResult(section1) + var result1 = new TechnicalInnovationFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new TechnicalInnovationFailureMechanismSectionResult(section2) + var result2 = new TechnicalInnovationFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new TechnicalInnovationFailureMechanismSectionResult(section3) + var result3 = new TechnicalInnovationFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new TechnicalInnovationFailureMechanismSectionResult(section4) + var result4 = new TechnicalInnovationFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerThree = random.NextRoundedDouble() @@ -192,12 +178,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new TechnicalInnovationFailureMechanismSectionResult(section) + var result = new TechnicalInnovationFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs =================================================================== diff -u -r999ba524ca29111b9474209a11b7aeabf233409f -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs (.../WaterPressureAsphaltCoverResultViewTest.cs) (revision 999ba524ca29111b9474209a11b7aeabf233409f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultViews/WaterPressureAsphaltCoverResultViewTest.cs (.../WaterPressureAsphaltCoverResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,10 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; -using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.Integration.Data.StandAlone; @@ -92,40 +91,27 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new WaterPressureAsphaltCoverFailureMechanismSectionResult(section1) + var result1 = new WaterPressureAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new WaterPressureAsphaltCoverFailureMechanismSectionResult(section2) + var result2 = new WaterPressureAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new WaterPressureAsphaltCoverFailureMechanismSectionResult(section3) + var result3 = new WaterPressureAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new WaterPressureAsphaltCoverFailureMechanismSectionResult(section4) + var result4 = new WaterPressureAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerThree = random.NextRoundedDouble() @@ -192,12 +178,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new WaterPressureAsphaltCoverFailureMechanismSectionResult(section) + var result = new WaterPressureAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerThree = random.NextRoundedDouble() Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r2bbb6cb90c0de4f885e79b299b5e6575ff46effd -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs (.../PipingFailureMechanismResultViewInfoTest.cs) (revision 2bbb6cb90c0de4f885e79b299b5e6575ff46effd) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismResultViewInfoTest.cs (.../PipingFailureMechanismResultViewInfoTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; -using Core.Common.Base; using Core.Common.Controls.Views; using Core.Common.Gui.Plugin; using Core.Common.TestUtil; @@ -95,8 +94,10 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - using (var view = new PipingFailureMechanismResultView(new ObservableList(), - new PipingFailureMechanism(), + var failureMechanism = new PipingFailureMechanism(); + + using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, + failureMechanism, assessmentSection)) { // Call @@ -129,7 +130,7 @@ var failureMechanism = new PipingFailureMechanism(); - using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, new PipingFailureMechanism(), assessmentSection)) + using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism, assessmentSection)) { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -156,7 +157,7 @@ var failureMechanism = new PipingFailureMechanism(); - using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, new PipingFailureMechanism(), assessmentSection)) + using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism, assessmentSection)) { // Call bool closeForData = info.CloseForData(view, assessmentSection); @@ -223,7 +224,7 @@ mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); - using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, new PipingFailureMechanism(), assessmentSection)) + using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism, assessmentSection)) { // Call bool closeForData = info.CloseForData(view, new PipingFailureMechanism()); @@ -264,7 +265,7 @@ mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); - using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, new PipingFailureMechanism(), assessmentSection)) + using (var view = new PipingFailureMechanismResultView(failureMechanism.SectionResults, failureMechanism, assessmentSection)) { var failureMechanismContext = new PipingFailureMechanismContext( new PipingFailureMechanism(), Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -ra273ecd8af1fec2d1c156a3c25c5aefac5b1307b -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision a273ecd8af1fec2d1c156a3c25c5aefac5b1307b) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -207,31 +207,21 @@ public void FailureMechanismResultView_WithFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new StabilityPointStructuresFailureMechanismSectionResult(section1) + var result1 = new StabilityPointStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new StabilityPointStructuresFailureMechanismSectionResult(section2) + var result2 = new StabilityPointStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.Applicable, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new StabilityPointStructuresFailureMechanismSectionResult(section3) + var result3 = new StabilityPointStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.None, AssessmentLayerThree = random.NextRoundedDouble() @@ -294,12 +284,9 @@ SimpleAssessmentResultValidityOnlyType assessmentLayerOneState) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new StabilityPointStructuresFailureMechanismSectionResult(section) + var result = new StabilityPointStructuresFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = assessmentLayerOneState, AssessmentLayerThree = random.NextRoundedDouble() @@ -333,7 +320,7 @@ public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given - var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { AssessmentLayerOne = assessmentLayerOneState }; @@ -365,7 +352,7 @@ SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation(), SimpleAssessmentResult = simpleAssessmentResult @@ -397,7 +384,7 @@ public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given - var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -430,7 +417,7 @@ public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError() { // Given - var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -491,7 +478,7 @@ SimpleAssessmentResultValidityOnlyType simpleAssessmentResult) { // Given - var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { Calculation = new StructuresCalculation { @@ -595,7 +582,7 @@ private static IEnumerable GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage() { - FailureMechanismSection section = CreateSimpleFailureMechanismSection(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); yield return new TestCaseData(new StabilityPointStructuresFailureMechanismSectionResult(section) { @@ -624,15 +611,6 @@ }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutput"); } - private static FailureMechanismSection CreateSimpleFailureMechanismSection() - { - return FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - } - private StabilityPointStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView( StabilityPointStructuresFailureMechanism failureMechanism) { Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs =================================================================== diff -u -r607494c1b1e1e5fd53be1f474c3e8042245e6467 -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs (.../StabilityStoneCoverResultViewTest.cs) (revision 607494c1b1e1e5fd53be1f474c3e8042245e6467) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverResultViewTest.cs (.../StabilityStoneCoverResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -27,6 +27,7 @@ using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.StabilityStoneCover.Data; @@ -94,33 +95,20 @@ public void StabilityStoneCoverFailureMechanismResultView_WithStabilityStoneCoverFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new StabilityStoneCoverFailureMechanismSectionResult(section1) + var result1 = new StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new StabilityStoneCoverFailureMechanismSectionResult(section2) + var result2 = new StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new StabilityStoneCoverFailureMechanismSectionResult(section3) + var result3 = new StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.Applicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs =================================================================== diff -u -r24264daa736095a5d9b14415ffced9601cb123fe -r1a65cb67261da126d57a2c890acfb78b4347eb3d --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision 24264daa736095a5d9b14415ffced9601cb123fe) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismResultViewTest.cs) (revision 1a65cb67261da126d57a2c890acfb78b4347eb3d) @@ -22,11 +22,11 @@ using System; using System.Windows.Forms; using Core.Common.Base; -using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; using Ringtoets.WaveImpactAsphaltCover.Data; @@ -94,43 +94,30 @@ public void WaveImpactAsphaltCoverFailureMechanismResultView_WithWaveImpactAsphaltCoverFailureMechanismSectionResultAssigned_SectionsAddedAsRows() { // Setup - var section1 = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); - var section2 = new FailureMechanismSection("Section 2", new[] - { - new Point2D(0, 0) - }); - var section3 = new FailureMechanismSection("Section 3", new[] - { - new Point2D(0, 0) - }); - var section4 = new FailureMechanismSection("Section 4", new[] - { - new Point2D(0, 0) - }); - var random = new Random(21); - var result1 = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section1) + var result1 = new WaveImpactAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 1")) { SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed, AssessmentLayerThree = random.NextRoundedDouble() }; - var result2 = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section2) + var result2 = new WaveImpactAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 2")) { SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result3 = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section3) + var result3 = new WaveImpactAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 3")) { SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, AssessmentLayerThree = random.NextRoundedDouble() }; - var result4 = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section4) + var result4 = new WaveImpactAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection("Section 4")) { SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Successful, @@ -185,7 +172,7 @@ DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); - + cells = rows[3].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 4", cells[nameColumnIndex].FormattedValue); @@ -205,12 +192,9 @@ SimpleAssessmentResultType simpleAssessmentResult) { // Given - var section = new FailureMechanismSection("Section 1", new[] - { - new Point2D(0, 0) - }); var random = new Random(21); - var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult(section) + var result = new WaveImpactAsphaltCoverFailureMechanismSectionResult( + FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) { SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerTwoA = AssessmentLayerTwoAResult.Failed,