Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs =================================================================== diff -u -r2cf2214c4069c98c3cb21708729fcbc2ca964ab6 -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 2cf2214c4069c98c3cb21708729fcbc2ca964ab6) +++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -428,6 +428,23 @@ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, someMessage); } + [Test] + [TestCase("param")] + [TestCase(null)] + public void AssertThrowsArgumentExceptionAndTestMessage_Always_ReturnsException(string argument) + { + // Setup + var someMessage = "Exception"; + TestDelegate t = () => { throw new ArgumentException(someMessage, argument); }; + + // Call + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(t, someMessage); + + // Assert + Assert.IsInstanceOf(exception); + Assert.AreEqual(argument, exception.ParamName); + } + private static ToolStripMenuItem CreateContextMenuItem() { return new ToolStripMenuItem Index: Core/Common/test/Core.Common.TestUtil/TestHelper.cs =================================================================== diff -u -r20415b2886919a103cb4677f56a8f61abbb7aa8a -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 20415b2886919a103cb4677f56a8f61abbb7aa8a) +++ Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -336,7 +336,7 @@ /// The type of the expected exception. /// The test to execute and should throw exception of type . /// The expected custom part of the exception message. - public static void AssertThrowsArgumentExceptionAndTestMessage(TestDelegate test, string expectedCustomMessage) where T : ArgumentException + public static T AssertThrowsArgumentExceptionAndTestMessage(TestDelegate test, string expectedCustomMessage) where T : ArgumentException { var exception = Assert.Throws(test); var message = exception.Message; @@ -351,6 +351,7 @@ message = String.Join(Environment.NewLine, customMessageParts.ToArray()); } Assert.AreEqual(expectedCustomMessage, message); + return exception; } /// Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r411b50528bbd83c02ffdcae699895529b2b34bf7 -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 411b50528bbd83c02ffdcae699895529b2b34bf7) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -132,6 +132,7 @@ {516EBC95-B8F2-428C-B7F6-733F01BF8FDD} Core.Components.Charting + False {d4200f43-3f72-4f42-af0a-8ced416a38ec} Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs =================================================================== diff -u -ra520ed551c5eecc830c54d4373f1efc82c64cb5f -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -39,7 +39,7 @@ /// /// Creates a new instance of the class. /// - /// worldCoordinate">The value for + /// worldCoordinate">The value for . /// The geometry of the dike. /// The geometry of the dike foreshore. /// Thrown when Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs =================================================================== diff -u -ra520ed551c5eecc830c54d4373f1efc82c64cb5f -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -20,9 +20,9 @@ // All rights reserved. using System; -using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.GrassCoverErosionInwards.Data.Properties; @@ -87,8 +87,7 @@ TestDelegate call = () => new DikeProfile(new Point2D(0, 0), null, new Point2D[0]); // Assert - var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetGeometry_Collection_of_points_for_geometry_is_null, exception.Message); + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, Resources.DikeProfile_SetGeometry_Collection_of_points_for_geometry_is_null); Assert.AreEqual("points", exception.ParamName); } @@ -102,8 +101,7 @@ }, new Point2D[0]); // Assert - var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null, exception.Message); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null); } [Test] @@ -113,8 +111,7 @@ TestDelegate call = () => new DikeProfile(new Point2D(0, 0), new RoughnessPoint[0], null); // Assert - var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null, exception.Message); + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, Resources.DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null); Assert.AreEqual("points", exception.ParamName); } @@ -128,8 +125,7 @@ }); // Assert - var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null, exception.Message); + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, Resources.DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null); } [Test] Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -80,8 +80,11 @@ new Point2D(6.6, 7.7) } : new Point2D[0]; - var dikeProfile = new DikeProfile(new Point2D(0, 0), new[] { new RoughnessPoint(new Point2D(2.2, 3.3), 0.6) }, foreShoreGeometry) + var dikeProfile = new DikeProfile(new Point2D(0, 0), new[] { + new RoughnessPoint(new Point2D(2.2, 3.3), 0.6) + }, foreShoreGeometry) + { Orientation = (RoundedDouble) 1.1, DikeHeight = (RoundedDouble) 4.4 }; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs =================================================================== diff -u -r0f2c3010ba8a0760af2c98f70abd6542a936ca32 -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs (.../GrassCoverErosionInwardsInputViewTest.cs) (revision 0f2c3010ba8a0760af2c98f70abd6542a936ca32) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs (.../GrassCoverErosionInwardsInputViewTest.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using Core.Common.Base; @@ -204,7 +203,7 @@ AssertForeshoreChartData(dikeProfile, chartData.List[foreshoreIndex]); AssertDikeHeightChartData(dikeProfile, chartData.List[dikeHeightIndex]); } - } + } [Test] public void Data_WithoutDikeProfile_CollectionOfEmptyDataSet() @@ -262,9 +261,9 @@ Assert.AreEqual(Resources.GrassCoverErosionInwardsInputContext_NodeDisplayName, chartData.Name); Assert.AreEqual(3, chartData.List.Count); - var dikeGeometryData = (ChartLineData)chartData.List[dikeProfileIndex]; - var foreShoreData = (ChartLineData)chartData.List[foreshoreIndex]; - var dikeHeightData = (ChartLineData)chartData.List[dikeHeightIndex]; + var dikeGeometryData = (ChartLineData) chartData.List[dikeProfileIndex]; + var foreShoreData = (ChartLineData) chartData.List[foreshoreIndex]; + var dikeHeightData = (ChartLineData) chartData.List[dikeHeightIndex]; CollectionAssert.IsEmpty(foreShoreData.Points); Assert.AreEqual(Resources.Foreshore_DisplayName, foreShoreData.Name); @@ -395,7 +394,7 @@ [Test] public void UpdateObservers_CalculationDikeProfileUpdated_SetNewChartData() { - // Setup + // Setup using (GrassCoverErosionInwardsInputView view = new GrassCoverErosionInwardsInputView()) { DikeProfile dikeProfile = GetDikeProfileWithGeometry(); @@ -419,11 +418,11 @@ input.NotifyObservers(); // Assert - ChartLineData newDikeProfileChartData = (ChartLineData)view.Chart.Data.List[dikeProfileIndex]; + ChartLineData newDikeProfileChartData = (ChartLineData) view.Chart.Data.List[dikeProfileIndex]; Assert.AreNotEqual(oldDikeProfileChartData, newDikeProfileChartData); AssertDikeProfileChartData(dikeProfile2, newDikeProfileChartData); - ChartLineData newForeshoreChartData = (ChartLineData)view.Chart.Data.List[foreshoreIndex]; + ChartLineData newForeshoreChartData = (ChartLineData) view.Chart.Data.List[foreshoreIndex]; Assert.AreNotEqual(oldForeshoreChartData, newForeshoreChartData); AssertForeshoreChartData(dikeProfile2, newForeshoreChartData); @@ -510,11 +509,11 @@ var foreshore = new[] { - new Point2D(1.0, 2.0), - new Point2D(5.0, 6.0), - new Point2D(8.0, 9.0), + new Point2D(1.0, 2.0), + new Point2D(5.0, 6.0), + new Point2D(8.0, 9.0), }; - + return GetDikeProfile(points, foreshore); } @@ -529,9 +528,9 @@ var foreshore = new[] { - new Point2D(0.0, 0.0), - new Point2D(1.0, 1.0), - new Point2D(2.0, 2.0), + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0), }; return GetDikeProfile(points, foreshore); @@ -550,7 +549,7 @@ private void AssertDikeProfileChartData(DikeProfile dikeProfile, ChartData chartData) { Assert.IsInstanceOf(chartData); - ChartLineData dikeProfileChartData = (ChartLineData)chartData; + ChartLineData dikeProfileChartData = (ChartLineData) chartData; RoughnessPoint[] dikeGeometry = dikeProfile.DikeGeometry; Assert.AreEqual(dikeGeometry.Length, dikeProfileChartData.Points.Count()); @@ -561,7 +560,7 @@ private void AssertForeshoreChartData(DikeProfile dikeProfile, ChartData chartData) { Assert.IsInstanceOf(chartData); - ChartLineData foreshoreChartData = (ChartLineData)chartData; + ChartLineData foreshoreChartData = (ChartLineData) chartData; Point2D[] foreshoreGeometry = dikeProfile.ForeshoreGeometry; Assert.AreEqual(foreshoreGeometry.Length, foreshoreChartData.Points.Count()); @@ -572,9 +571,10 @@ private void AssertDikeHeightChartData(DikeProfile dikeProfile, ChartData chartData) { Assert.IsInstanceOf(chartData); - ChartLineData dikeHeightChartData = (ChartLineData)chartData; + ChartLineData dikeHeightChartData = (ChartLineData) chartData; - Point2D[] dikeHeightGeometry = { + Point2D[] dikeHeightGeometry = + { new Point2D(dikeProfile.DikeGeometry.First().Point.X, dikeProfile.DikeHeight), new Point2D(dikeProfile.DikeGeometry.Last().Point.X, dikeProfile.DikeHeight) }; Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r0f2c3010ba8a0760af2c98f70abd6542a936ca32 -r886c94611e3a5cc72a9e134a7fb02ba617fe7f38 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 0f2c3010ba8a0760af2c98f70abd6542a936ca32) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 886c94611e3a5cc72a9e134a7fb02ba617fe7f38) @@ -350,8 +350,8 @@ if (failureMechanism != null) { calculationInputs = failureMechanism.CalculationsGroup.GetCalculations() - .OfType() - .Select(c => c.InputParameters); + .OfType() + .Select(c => c.InputParameters); } }