Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/TestForeshoreProfileTest.cs =================================================================== diff -u -r2973c5f790a5131e427bd5f73e2a620044199639 -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/TestForeshoreProfileTest.cs (.../TestForeshoreProfileTest.cs) (revision 2973c5f790a5131e427bd5f73e2a620044199639) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/TestForeshoreProfileTest.cs (.../TestForeshoreProfileTest.cs) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -21,6 +21,7 @@ using Core.Common.Base.Geometry; using NUnit.Framework; +using Ringtoets.Common.Data.DikeProfiles; namespace Application.Ringtoets.Storage.TestUtil.Test { @@ -41,5 +42,42 @@ Assert.AreEqual(0.0, profile.Orientation.Value); Assert.AreEqual(new Point2D(0, 0), profile.WorldReferencePoint); } + + [Test] + public void Constructor_UseBreakWater_ReturnsSectionWithEmptyNameAndOnePointAtOriginAndDefaultBreakWater() + { + // Call + var profile = new TestForeshoreProfile(); + + // Assert + Assert.IsEmpty(profile.Geometry); + Assert.IsNull(profile.Name); + Assert.IsTrue(profile.HasBreakWater); + Assert.IsNotNull(profile.BreakWater); + Assert.AreEqual(BreakWaterType.Dam, profile.BreakWater.Type); + Assert.AreEqual(10.0, profile.BreakWater.Height); + Assert.AreEqual(0.0, profile.X0); + Assert.AreEqual(0.0, profile.Orientation.Value); + Assert.AreEqual(new Point2D(0, 0), profile.WorldReferencePoint); + } + + [Test] + public void ConstructorWithBreakWater_Always_ReturnsSectionWithEmptyNameAndOnePointAtOriginAndBreakWater() + { + // Setup + var breakWater = new BreakWater(BreakWaterType.Dam, 50.0); + + // Call + var profile = new TestForeshoreProfile(breakWater); + + // Assert + Assert.IsEmpty(profile.Geometry); + Assert.IsNull(profile.Name); + Assert.AreSame(breakWater, profile.BreakWater); + Assert.IsTrue(profile.HasBreakWater); + Assert.AreEqual(0.0, profile.X0); + Assert.AreEqual(0.0, profile.Orientation.Value); + Assert.AreEqual(new Point2D(0, 0), profile.WorldReferencePoint); + } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/TestForeshoreProfile.cs =================================================================== diff -u -r2973c5f790a5131e427bd5f73e2a620044199639 -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/TestForeshoreProfile.cs (.../TestForeshoreProfile.cs) (revision 2973c5f790a5131e427bd5f73e2a620044199639) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/TestForeshoreProfile.cs (.../TestForeshoreProfile.cs) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -33,6 +33,13 @@ /// /// Creates a new instance of . /// - public TestForeshoreProfile() : base(new Point2D(0, 0), Enumerable.Empty(), null, new ConstructionProperties()) {} + /// If true, create the ForeshoreProfile with a default . + public TestForeshoreProfile(bool useBreakWater = false) : base(new Point2D(0, 0), Enumerable.Empty(), useBreakWater ? new BreakWater(BreakWaterType.Dam, 10) : null, new ConstructionProperties()) { } + + /// + /// Creates a new instance of with a specified. + /// + /// The which needs to be set on the . + public TestForeshoreProfile(BreakWater breakWater) : base(new Point2D(0, 0), Enumerable.Empty(), breakWater, new ConstructionProperties()) {} } } \ No newline at end of file Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs =================================================================== diff -u -rcc27fe12a2d3f982685791389aa68fd6ca25fcd0 -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision cc27fe12a2d3f982685791389aa68fd6ca25fcd0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/ClosingStructuresCalculationServiceTest.cs (.../ClosingStructuresCalculationServiceTest.cs) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -23,6 +23,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; @@ -463,7 +464,7 @@ { InflowModelType = inflowModelType, HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2), - ForeshoreProfile = CreateForeshoreProfile(new BreakWater(BreakWaterType.Dam, breakWaterHeight)), + ForeshoreProfile = new TestForeshoreProfile(new BreakWater(BreakWaterType.Dam, breakWaterHeight)), UseBreakWater = true } }; @@ -790,7 +791,7 @@ { HydraulicBoundaryLocation = assessmentSectionStub.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), InflowModelType = inflowModelType, - ForeshoreProfile = CreateForeshoreProfile(new BreakWater(BreakWaterType.Dam, 10)), + ForeshoreProfile = new TestForeshoreProfile(true), UseForeshore = true, UseBreakWater = true } @@ -804,7 +805,7 @@ calculation.InputParameters.UseBreakWater = false; break; case CalculationType.ForeshoreWithoutBreakWater: - calculation.InputParameters.ForeshoreProfile = CreateForeshoreProfile(null); + calculation.InputParameters.ForeshoreProfile = new TestForeshoreProfile(); calculation.InputParameters.UseBreakWater = false; break; case CalculationType.ForeshoreWithValidBreakWater: @@ -1002,18 +1003,6 @@ } } - private static ForeshoreProfile CreateForeshoreProfile(BreakWater breakWater) - { - return new ForeshoreProfile(new Point2D(0, 0), - new[] - { - new Point2D(3.3, 4.4), - new Point2D(5.5, 6.6) - }, - breakWater, - new ForeshoreProfile.ConstructionProperties()); - } - #region Parameter name mappings private const string insideWaterLevel = "binnenwaterstand"; Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj =================================================================== diff -u -rd79d26d2ad423b4287d5cdaeb0ac267089a54bf9 -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj (.../Ringtoets.ClosingStructures.Service.Test.csproj) (revision d79d26d2ad423b4287d5cdaeb0ac267089a54bf9) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Service.Test/Ringtoets.ClosingStructures.Service.Test.csproj (.../Ringtoets.ClosingStructures.Service.Test.csproj) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -67,6 +67,10 @@ + + {03DBE353-99F7-47D6-B826-60D694FFB9AC} + Application.Ringtoets.Storage.TestUtil + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} Core.Common.Base Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs =================================================================== diff -u -r3dba5efb1341e8aaba0de9848669b1c7e45cdfda -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs (.../StructuresInputBasePropertiesTest.cs) (revision 3dba5efb1341e8aaba0de9848669b1c7e45cdfda) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/StructuresInputBasePropertiesTest.cs (.../StructuresInputBasePropertiesTest.cs) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -24,6 +24,7 @@ using System.ComponentModel; using System.Globalization; using System.Linq; +using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -219,7 +220,7 @@ var random = new Random(100); double newStructureNormalOrientation = random.NextDouble(); var newStructure = new SimpleStructure(); - ForeshoreProfile newForeshoreProfile = CreateForeshoreProfile(); + ForeshoreProfile newForeshoreProfile = new TestForeshoreProfile(); HydraulicBoundaryLocation newHydraulicBoundaryLocation = CreateHydraulicBoundaryLocation(); // Call @@ -574,11 +575,6 @@ return new HydraulicBoundaryLocation(0, "", 0, 0); } - private static ForeshoreProfile CreateForeshoreProfile() - { - return new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(), null, new ForeshoreProfile.ConstructionProperties()); - } - private class SimpleStructure : StructureBase { public SimpleStructure() : base("Name", "Id", new Point2D(0, 0), 0.0) {} @@ -598,7 +594,7 @@ public override IEnumerable GetAvailableForeshoreProfiles() { - yield return CreateForeshoreProfile(); + yield return new TestForeshoreProfile(); } public override IEnumerable GetAvailableStructures() Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r86984ca293c30b4f9b47da7825cbae1404fffe08 -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 86984ca293c30b4f9b47da7825cbae1404fffe08) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -117,6 +117,10 @@ + + {03DBE353-99F7-47D6-B826-60D694FFB9AC} + Application.Ringtoets.Storage.TestUtil + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} Core.Common.Base Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/ForeshoreProfileEditorTest.cs =================================================================== diff -u -rddcad0ec18079f8c827bfa82ba406b3eab76fbfe -r64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/ForeshoreProfileEditorTest.cs (.../ForeshoreProfileEditorTest.cs) (revision ddcad0ec18079f8c827bfa82ba406b3eab76fbfe) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/ForeshoreProfileEditorTest.cs (.../ForeshoreProfileEditorTest.cs) (revision 64b9d05b572ff4878d9e74c6d1e4586e1b6d0a3d) @@ -22,9 +22,8 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using System.Windows.Forms.Design; -using Core.Common.Base.Geometry; +using Application.Ringtoets.Storage.TestUtil; using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; @@ -59,7 +58,7 @@ public void EditValue_WithCurrentItemNotInAvailableItems_ReturnsOriginalValue() { // Setup - var foreshoreProfile = CreateForeshoreProfile(); + var foreshoreProfile = new TestForeshoreProfile(); var properties = new ObjectPropertiesWithForeshoreProfile(foreshoreProfile, new ForeshoreProfile[0]); var propertyBag = new DynamicPropertyBag(properties); var editor = new ForeshoreProfileEditor(); @@ -83,7 +82,7 @@ public void EditValue_WithCurrentItemInAvailableItems_ReturnsCurrentItem() { // Setup - var foreshoreProfile = CreateForeshoreProfile(); + var foreshoreProfile = new TestForeshoreProfile(); var properties = new ObjectPropertiesWithForeshoreProfile(foreshoreProfile, new[] { foreshoreProfile @@ -106,11 +105,6 @@ mockRepository.VerifyAll(); } - private static ForeshoreProfile CreateForeshoreProfile() - { - return new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(), new BreakWater(BreakWaterType.Caisson, 0.0), new ForeshoreProfile.ConstructionProperties()); - } - private class ForeshoreProfileEditorWithPublicNullItem : ForeshoreProfileEditor { public ForeshoreProfile PublicNullItem