Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultSubMechanismIllustrationPointCreateExtensionsTest.cs
===================================================================
diff -u -r2c08730c6c2269937fa4f117aed1557876c567ea -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultSubMechanismIllustrationPointCreateExtensionsTest.cs (.../GeneralResultSubMechanismIllustrationPointCreateExtensionsTest.cs) (revision 2c08730c6c2269937fa4f117aed1557876c567ea)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/IllustrationPoints/GeneralResultSubMechanismIllustrationPointCreateExtensionsTest.cs (.../GeneralResultSubMechanismIllustrationPointCreateExtensionsTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -130,10 +130,10 @@
var governingWindDirection = new WindDirection(windDirectionName, windDirectionAngle);
const string illustrationPointName = "illustrationPoint";
- var illustrationPointOne = new TopLevelSubMechanismIllustrationPoint(new TestWindDirection(),
+ var illustrationPointOne = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
illustrationPointName,
new TestSubMechanismIllustrationPoint());
- var illustrationPointTwo = new TopLevelSubMechanismIllustrationPoint(new TestWindDirection(),
+ var illustrationPointTwo = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
$"{illustrationPointName}_Two",
new TestSubMechanismIllustrationPoint());
var illustrationPoints = new[]
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs
===================================================================
diff -u -r2c08730c6c2269937fa4f117aed1557876c567ea -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs (.../GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs) (revision 2c08730c6c2269937fa4f117aed1557876c567ea)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/IllustrationPoints/GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs (.../GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -128,7 +128,7 @@
{
// Setup
const string stochastName = "Stochast Name";
- WindDirection windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
SubMechanismIllustrationPoint illustrationPoint = new TestSubMechanismIllustrationPoint();
var illustrationPointEntityOne = new TopLevelSubMechanismIllustrationPointEntity
{
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs
===================================================================
diff -u -r6a60e0e3f676c71e253ad41839519c18dd641e9e -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs (.../SubMechanismIllustrationPoint.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/SubMechanismIllustrationPoint.cs (.../SubMechanismIllustrationPoint.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -33,7 +33,7 @@
///
/// Creates a new instance of .
///
- /// The name of the illustration point result
+ /// The name of the illustration point result.
/// The stochasts for the sub mechanism illustration point.
/// The output variables.
/// The beta value that was realized.
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/WindDirection.cs
===================================================================
diff -u -r342ecb50ef0e54c04002a2643689c6d0108518c7 -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/WindDirection.cs (.../WindDirection.cs) (revision 342ecb50ef0e54c04002a2643689c6d0108518c7)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Hydraulics/IllustrationPoints/WindDirection.cs (.../WindDirection.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -27,7 +27,7 @@
///
/// A wind direction.
///
- public class WindDirection
+ public sealed class WindDirection
{
///
/// Creates a new instance of .
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultSubMechanismIllustrationPointTest.cs
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultSubMechanismIllustrationPointTest.cs (.../GeneralResultSubMechanismIllustrationPointTest.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/GeneralResultSubMechanismIllustrationPointTest.cs (.../GeneralResultSubMechanismIllustrationPointTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -48,7 +48,7 @@
public void Constructor_StochastsNull_ThrowsArgumentNullException()
{
// Setup
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
// Call
TestDelegate call = () => new GeneralResultSubMechanismIllustrationPoint(windDirection,
@@ -64,7 +64,7 @@
public void Constructor_TopLevelSubMechanismIllustrationPointsNull_ThrowsArgumentNullException()
{
// Setup
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
// Call
TestDelegate call = () => new GeneralResultSubMechanismIllustrationPoint(windDirection,
@@ -80,7 +80,7 @@
public void Constructor_ValidArguments_ExpectedProperties()
{
// Setup
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
IEnumerable stochasts = Enumerable.Empty();
IEnumerable combinations =
Enumerable.Empty();
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs
===================================================================
diff -u -rc2c7e9621863d470ddd3a1d5c0e4913844066aae -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs (.../TopLevelSubMechanismIllustrationPointTest.cs) (revision c2c7e9621863d470ddd3a1d5c0e4913844066aae)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/IllustrationPoints/TopLevelSubMechanismIllustrationPointTest.cs (.../TopLevelSubMechanismIllustrationPointTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -48,7 +48,7 @@
public void Constructor_ClosingSituationNull_ThrowsArgumentNullException()
{
// Setup
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
var submechanismIllustrationPoint = new TestSubMechanismIllustrationPoint();
// Call
@@ -64,7 +64,7 @@
public void Constructor_SubMechanismIllustationPointNull_ThrowsArgumentNullException()
{
// Setup
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
// Call
TestDelegate call = () =>
@@ -80,7 +80,7 @@
{
// Setup
const string closingScenario = "closing scenario";
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
var submechanismIllustrationPoint = new TestSubMechanismIllustrationPoint();
// Call
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPointTest.cs
===================================================================
diff -u -r2c08730c6c2269937fa4f117aed1557876c567ea -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPointTest.cs (.../TestGeneralResultSubMechanismIllustrationPointTest.cs) (revision 2c08730c6c2269937fa4f117aed1557876c567ea)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPointTest.cs (.../TestGeneralResultSubMechanismIllustrationPointTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -36,7 +36,7 @@
// Assert
Assert.IsInstanceOf(generalResult);
- AssertWindDirection(new TestWindDirection(), generalResult.GoverningWindDirection);
+ AssertWindDirection(WindDirectionTestFactory.CreateTestWindDirection(), generalResult.GoverningWindDirection);
CollectionAssert.IsEmpty(generalResult.Stochasts);
CollectionAssert.IsEmpty(generalResult.TopLevelSubMechanismIllustrationPoints);
}
Fisheye: Tag ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/TestWindDirectionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/WindDirectionTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/WindDirectionTestFactoryTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/IllustrationPoints/WindDirectionTestFactoryTest.cs (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -0,0 +1,44 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+
+namespace Ringtoets.Common.Data.TestUtil.Test.IllustrationPoints
+{
+ [TestFixture]
+ public class WindDirectionTestFactoryTest
+ {
+ [Test]
+ public void CreateTestWindDirection_ReturnsExpectedProperties()
+ {
+ // Call
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
+
+ // Assert
+ Assert.IsInstanceOf(windDirection);
+
+ Assert.AreEqual("SSE", windDirection.Name);
+ Assert.AreEqual(5.0, windDirection.Angle, windDirection.Angle.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj
===================================================================
diff -u -r2c08730c6c2269937fa4f117aed1557876c567ea -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 2c08730c6c2269937fa4f117aed1557876c567ea)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -57,7 +57,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPoint.cs
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPoint.cs (.../TestGeneralResultSubMechanismIllustrationPoint.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestGeneralResultSubMechanismIllustrationPoint.cs (.../TestGeneralResultSubMechanismIllustrationPoint.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -33,8 +33,8 @@
/// Creates a new instance of .
///
public TestGeneralResultSubMechanismIllustrationPoint()
- : base(new TestWindDirection(),
- Enumerable.Empty(),
- Enumerable.Empty()) {}
+ : base(WindDirectionTestFactory.CreateTestWindDirection(),
+ Enumerable.Empty(),
+ Enumerable.Empty()) {}
}
}
\ No newline at end of file
Fisheye: Tag ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/TestWindDirection.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/WindDirectionTestFactory.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/WindDirectionTestFactory.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/IllustrationPoints/WindDirectionTestFactory.cs (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -0,0 +1,39 @@
+// 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.Hydraulics.IllustrationPoints;
+
+namespace Ringtoets.Common.Data.TestUtil.IllustrationPoints
+{
+ ///
+ /// Factory to create simple wind direction that can be used for testing.
+ ///
+ public static class WindDirectionTestFactory
+ {
+ ///
+ /// Creates a new instance of used for testing.
+ ///
+ public static WindDirection CreateTestWindDirection()
+ {
+ return new WindDirection("SSE", 5.0);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -76,7 +76,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs (.../RingtoetsStackChartDataFactoryTest.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Factories/RingtoetsStackChartDataFactoryTest.cs (.../RingtoetsStackChartDataFactoryTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -72,7 +72,7 @@
{
// Setup
var stackChartData = new StackChartData();
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
var generalResult = new GeneralResultSubMechanismIllustrationPoint(
windDirection,
Enumerable.Empty(),
@@ -107,7 +107,7 @@
const string closingSituationClosed = "Closed";
const string closingSituationOpen = "Open";
- var windDirection = new TestWindDirection();
+ WindDirection windDirection = WindDirectionTestFactory.CreateTestWindDirection();
var stackChartData = new StackChartData();
var generalResult = new GeneralResultSubMechanismIllustrationPoint(
@@ -164,12 +164,12 @@
{
var stackChartData = new StackChartData();
var generalResult = new GeneralResultSubMechanismIllustrationPoint(
- new TestWindDirection(),
- Enumerable.Empty(),
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ Enumerable.Empty(),
new[]
{
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 1",
new[]
{
@@ -181,7 +181,7 @@
},
Enumerable.Empty(), 1)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 2",
new[]
{
@@ -193,7 +193,7 @@
},
Enumerable.Empty(), 1)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 3",
new[]
{
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs
===================================================================
diff -u -r6a60e0e3f676c71e253ad41839519c18dd641e9e -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (.../TopLevelSubMechanismIllustrationPointPropertiesTest.cs) (revision 6a60e0e3f676c71e253ad41839519c18dd641e9e)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (.../TopLevelSubMechanismIllustrationPointPropertiesTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -55,7 +55,9 @@
Enumerable.Empty(),
Enumerable.Empty(),
3);
- var context = new TopLevelSubMechanismIllustrationPoint(new TestWindDirection(), "direction", submechanismIllustrationPoint);
+ var context = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ "direction",
+ submechanismIllustrationPoint);
// Call
var hydraulicBoundaryLocationProperties = new TopLevelSubMechanismIllustrationPointProperties
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointRowTest.cs
===================================================================
diff -u -r29c0d37342d76d0bc06b1696aeaf56a316f86a19 -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointRowTest.cs (.../IllustrationPointRowTest.cs) (revision 29c0d37342d76d0bc06b1696aeaf56a316f86a19)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointRowTest.cs (.../IllustrationPointRowTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -47,7 +47,8 @@
{
// Setup
var illustrationPoint = new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ "Regular",
new TestSubMechanismIllustrationPoint());
// Call
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsChartControlTest.cs (.../IllustrationPointsChartControlTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -130,12 +130,12 @@
// When
chartControl.Data = new GeneralResultSubMechanismIllustrationPoint(
- new TestWindDirection(),
+ WindDirectionTestFactory.CreateTestWindDirection(),
Enumerable.Empty(),
new[]
{
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 1",
new[]
{
@@ -144,7 +144,7 @@
},
Enumerable.Empty(), 1)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 2",
new[]
{
@@ -167,12 +167,12 @@
private static GeneralResultSubMechanismIllustrationPoint GetGeneralResult()
{
return new GeneralResultSubMechanismIllustrationPoint(
- new TestWindDirection(),
+ WindDirectionTestFactory.CreateTestWindDirection(),
Enumerable.Empty(),
new[]
{
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 1",
new[]
{
@@ -183,7 +183,7 @@
},
Enumerable.Empty(), 1)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 2",
new[]
{
@@ -194,7 +194,7 @@
},
Enumerable.Empty(), 1)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Punt 3",
new[]
{
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs
===================================================================
diff -u -r29c0d37342d76d0bc06b1696aeaf56a316f86a19 -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision 29c0d37342d76d0bc06b1696aeaf56a316f86a19)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/IllustrationPointsTableControlTest.cs (.../IllustrationPointsTableControlTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -134,16 +134,16 @@
{
// Setup
var data = new GeneralResultSubMechanismIllustrationPoint(
- new TestWindDirection(),
+ WindDirectionTestFactory.CreateTestWindDirection(),
Enumerable.Empty(),
new[]
{
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Point 1", Enumerable.Empty(),
Enumerable.Empty(), 0.9)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Point 2", Enumerable.Empty(),
Enumerable.Empty(), 0.7))
});
@@ -183,7 +183,7 @@
IllustrationPointsTableControl control = ShowControl();
control.Data = data;
- var dataGridView = (DataGridView)control.Controls.Find("DataGridView", true).Single();
+ var dataGridView = (DataGridView) control.Controls.Find("DataGridView", true).Single();
DataGridViewRowCollection rows = dataGridView.Rows;
// Precondition
@@ -204,11 +204,11 @@
// Given
IllustrationPointsTableControl control = ShowControl();
control.Data = GetGeneralResult();
-
+
var selectionChangedCount = 0;
control.SelectionChanged += (sender, args) => selectionChangedCount++;
- var dataGridView = (DataGridView)control.Controls.Find("DataGridView", true)[0];
+ var dataGridView = (DataGridView) control.Controls.Find("DataGridView", true)[0];
// When
dataGridView.CurrentCell = dataGridView.Rows[1].Cells[calculatedProbabilityColumnIndex];
@@ -236,7 +236,7 @@
IllustrationPointsTableControl control = ShowControl();
control.Data = GetGeneralResult();
- var dataGridView = (DataGridView)testForm.Controls.Find("dataGridView", true).First();
+ var dataGridView = (DataGridView) testForm.Controls.Find("dataGridView", true).First();
DataGridViewRow selectedLocationRow = dataGridView.Rows[0];
selectedLocationRow.Cells[0].Value = true;
@@ -262,16 +262,16 @@
private static GeneralResultSubMechanismIllustrationPoint GetGeneralResult()
{
return new GeneralResultSubMechanismIllustrationPoint(
- new TestWindDirection(),
+ WindDirectionTestFactory.CreateTestWindDirection(),
Enumerable.Empty(),
new[]
{
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Regular",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Regular",
new SubMechanismIllustrationPoint("Point 1", Enumerable.Empty(),
Enumerable.Empty(), 0.9)),
new TopLevelSubMechanismIllustrationPoint(
- new TestWindDirection(), "Open",
+ WindDirectionTestFactory.CreateTestWindDirection(), "Open",
new SubMechanismIllustrationPoint("Point 2", Enumerable.Empty(),
Enumerable.Empty(), 0.7))
});
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs
===================================================================
diff -u -ra5c551a343fee7ea3d7e46dd36c82cf180a1b597 -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision a5c551a343fee7ea3d7e46dd36c82cf180a1b597)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/DesignWaterLevelCalculationServiceTest.cs (.../DesignWaterLevelCalculationServiceTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -25,7 +25,6 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Rhino.Mocks.Constraints;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.TestUtil;
@@ -205,8 +204,7 @@
var mockRepository = new MockRepository();
var calculator = mockRepository.Stub();
- calculator.Expect(c => c.CalculateWithIllustrationPoints(null))
- .Constraints(new TypeOf(typeof(AssessmentLevelCalculationInput)))
+ calculator.Expect(c => c.CalculateWithIllustrationPoints(Arg.Is.TypeOf))
.Throw(expectedException);
calculator.Stub(c => c.LastErrorFileContent).Return(string.Empty);
calculator.Stub(c => c.OutputDirectory).Return(string.Empty);
@@ -330,152 +328,24 @@
}
[Test]
- public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException()
+ [TestCaseSource(typeof(HydraRingCalculatorTestCaseProvider), nameof(HydraRingCalculatorTestCaseProvider.GetCalculatorFailingConditionsWithReportDetails), new object[]
{
- // Setup
- string validFilePath = Path.Combine(testDataPath, validFile);
-
- const string locationName = "punt_flw_ 1";
- const string calculationName = "calculationName";
- const string calculationFailedMessage = "calculationFailedMessage";
- const double norm = 1.0 / 30;
-
- var calculator = new TestDesignWaterLevelCalculator
- {
- LastErrorFileContent = "An error occurred",
- EndInFailure = true
- };
-
- var mockRepository = new MockRepository();
- var calculatorFactory = mockRepository.StrictMock();
- calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator);
-
- var calculation = mockRepository.Stub();
- calculation.Stub(c => c.Name).Return(locationName);
- calculation.Expect(c => c.Id).Return(0);
- calculation.Expect(c => c.CalculateIllustrationPoints).Return(false);
-
- var calculationMessageProvider = mockRepository.StrictMock();
- calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
- mockRepository.ReplayAll();
-
- using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
- {
- var exceptionThrown = false;
-
- // Call
- Action call = () =>
- {
- try
- {
- new DesignWaterLevelCalculationService().Calculate(calculation,
- validFilePath,
- norm,
- calculationMessageProvider);
- }
- catch (HydraRingCalculationException)
- {
- exceptionThrown = true;
- }
- };
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] msgs = messages.ToArray();
- Assert.AreEqual(4, msgs.Length);
- CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedMessage, msgs[1]);
- StringAssert.StartsWith("Toetspeil berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
- CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
- });
- Assert.IsTrue(exceptionThrown);
- }
- mockRepository.VerifyAll();
- }
-
- [Test]
- public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException()
+ nameof(Run_InvalidCalculation_LogsErrorAndThrowException)
+ })]
+ public void Run_InvalidCalculation_LogsErrorAndThrowException(bool endInFailure, string lastErrorFileContent, string detailedReport)
{
// Setup
string validFilePath = Path.Combine(testDataPath, validFile);
const string locationName = "punt_flw_ 1";
const string calculationName = "calculationName";
- const string calculationFailedUnexplainedMessage = "calculationFailedUnexplainedMessage";
- const double norm = 1.0 / 30;
-
- var calculator = new TestDesignWaterLevelCalculator
- {
- EndInFailure = true
- };
-
- var mockRepository = new MockRepository();
- var calculatorFactory = mockRepository.StrictMock();
- calculatorFactory.Expect(cf => cf.CreateDesignWaterLevelCalculator(testDataPath)).Return(calculator);
-
- var calculation = mockRepository.Stub();
- calculation.Stub(c => c.Name).Return(locationName);
- calculation.Expect(c => c.Id).Return(0);
- calculation.Expect(c => c.CalculateIllustrationPoints).Return(false);
-
- var calculationMessageProvider = mockRepository.StrictMock();
- calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(locationName, calculator.HydraRingCalculationException.Message))
- .Return(calculationFailedUnexplainedMessage);
- mockRepository.ReplayAll();
-
- using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
- {
- var exceptionThrown = false;
-
- // Call
- Action call = () =>
- {
- try
- {
- new DesignWaterLevelCalculationService().Calculate(calculation,
- validFilePath,
- norm,
- calculationMessageProvider);
- }
- catch (HydraRingCalculationException)
- {
- exceptionThrown = true;
- }
- };
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] msgs = messages.ToArray();
- Assert.AreEqual(4, msgs.Length);
- CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedUnexplainedMessage, msgs[1]);
- StringAssert.StartsWith("Toetspeil berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
- CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
- });
- Assert.IsTrue(exceptionThrown);
- }
- mockRepository.VerifyAll();
- }
-
- [Test]
- public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException()
- {
- // Setup
- string validFilePath = Path.Combine(testDataPath, validFile);
-
- const string locationName = "punt_flw_ 1";
- const string calculationName = "calculationName";
const string calculationFailedMessage = "calculationFailedMessage";
const double norm = 1.0 / 30;
var calculator = new TestDesignWaterLevelCalculator
{
- EndInFailure = false,
- LastErrorFileContent = "An error occurred"
+ LastErrorFileContent = lastErrorFileContent,
+ EndInFailure = endInFailure
};
var mockRepository = new MockRepository();
@@ -489,13 +359,16 @@
var calculationMessageProvider = mockRepository.StrictMock();
calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ calculationMessageProvider.Expect(calc => calc.GetCalculationFailedMessage(locationName,
+ endInFailure && string.IsNullOrEmpty(lastErrorFileContent)
+ ? calculator.HydraRingCalculationException.Message
+ : lastErrorFileContent
+ )).Return(calculationFailedMessage);
mockRepository.ReplayAll();
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
- var exceptionThrown = false;
- string exceptionMessage = string.Empty;
+ HydraRingCalculationException exception = null;
// Call
Action call = () =>
@@ -509,8 +382,7 @@
}
catch (HydraRingCalculationException e)
{
- exceptionThrown = true;
- exceptionMessage = e.Message;
+ exception = e;
}
};
@@ -520,12 +392,13 @@
string[] msgs = messages.ToArray();
Assert.AreEqual(4, msgs.Length);
CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedMessage, msgs[1]);
- StringAssert.StartsWith("Toetspeil berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
+ Assert.AreEqual(calculationFailedMessage, msgs[1]);
+ Assert.AreEqual($"Toetspeil berekening is uitgevoerd op de tijdelijke locatie '{calculator.OutputDirectory}'. " +
+ "Gedetailleerde invoer en uitvoer kan in de bestanden op deze locatie worden gevonden.", msgs[2]);
CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
});
- Assert.IsTrue(exceptionThrown);
- Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage);
+
+ Assert.IsInstanceOf(exception);
}
mockRepository.VerifyAll();
}
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/CreateGeneralResultSubmechanismIllustrationPointConverterTest.cs
===================================================================
diff -u -r8ba742d2139563c9571e32f074c7c4b3077f45ee -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/CreateGeneralResultSubmechanismIllustrationPointConverterTest.cs (.../CreateGeneralResultSubmechanismIllustrationPointConverterTest.cs) (revision 8ba742d2139563c9571e32f074c7c4b3077f45ee)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/CreateGeneralResultSubmechanismIllustrationPointConverterTest.cs (.../CreateGeneralResultSubmechanismIllustrationPointConverterTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -59,19 +59,18 @@
{
// Setup
var random = new Random(21);
- double angle = random.NextDouble();
- var hydraGoverningWindDirection = new HydraRingWindDirection("Name", angle);
+ var hydraGoverningWindDirection = new HydraRingWindDirection("Name", random.NextDouble());
- var hydraRingGeneralResult =
- new HydraRingGeneralResult(random.NextDouble(),
- hydraGoverningWindDirection,
- Enumerable.Empty(),
- new Dictionary<
- HydraRingWindDirectionClosingSituation,
- HydraRingIllustrationPointTreeNode>());
+ var hydraRingGeneralResult = new HydraRingGeneralResult(
+ random.NextDouble(),
+ hydraGoverningWindDirection,
+ Enumerable.Empty(),
+ new Dictionary<
+ HydraRingWindDirectionClosingSituation,
+ HydraRingIllustrationPointTreeNode>());
// Call
- GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
+ GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
GeneralResultSubmechanismIllustrationPointConverter.CreateGeneralResultSubmechanismIllustrationPoint(hydraRingGeneralResult);
// Assert
@@ -87,34 +86,32 @@
const string closingSituation = "Closing situation";
var random = new Random(21);
- double windDirectionAngle = random.NextDouble();
- var hydraRingWindDirection = new HydraRingWindDirection("SSE", windDirectionAngle);
- var hydraRingWindDirectionClosingSituation =
- new HydraRingWindDirectionClosingSituation(hydraRingWindDirection, closingSituation);
+ var hydraRingWindDirection = new HydraRingWindDirection("SSE", random.NextDouble());
+ var hydraRingWindDirectionClosingSituation = new HydraRingWindDirectionClosingSituation(
+ hydraRingWindDirection, closingSituation);
- double beta = random.NextDouble();
- var hydraRingIllustrationPoint =
- new HydraRingSubMechanismIllustrationPoint("Illustration Point",
- Enumerable.Empty(),
- Enumerable.Empty(),
- beta);
+ var hydraRingIllustrationPoint = new HydraRingSubMechanismIllustrationPoint(
+ "Illustration Point",
+ Enumerable.Empty(),
+ Enumerable.Empty(),
+ random.NextDouble());
var hydraRingIllustrationTreeNode = new HydraRingIllustrationPointTreeNode(hydraRingIllustrationPoint);
double governingWindDirectionAngle = random.NextDouble();
var governingHydraWindDirection = new HydraRingWindDirection("Name", governingWindDirectionAngle);
- var hydraGeneralResult =
- new HydraRingGeneralResult(random.NextDouble(),
- governingHydraWindDirection,
- Enumerable.Empty(),
- new Dictionary
- {
- {
- hydraRingWindDirectionClosingSituation, hydraRingIllustrationTreeNode
- }
- });
+ var hydraGeneralResult = new HydraRingGeneralResult(
+ random.NextDouble(),
+ governingHydraWindDirection,
+ Enumerable.Empty(),
+ new Dictionary
+ {
+ {
+ hydraRingWindDirectionClosingSituation, hydraRingIllustrationTreeNode
+ }
+ });
// Call
- GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
+ GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
GeneralResultSubmechanismIllustrationPointConverter.CreateGeneralResultSubmechanismIllustrationPoint(hydraGeneralResult);
// Assert
@@ -141,32 +138,34 @@
var random = new Random(21);
const string closingSituation = "Closing situation";
- double windDirectionAngle = random.NextDouble();
- var hydraRingWindDirection = new HydraRingWindDirection("SSE", windDirectionAngle);
- var hydraRingWindDirectionClosingSituation =
- new HydraRingWindDirectionClosingSituation(hydraRingWindDirection, closingSituation);
+ var hydraRingWindDirection = new HydraRingWindDirection("SSE", random.NextDouble());
+ var hydraRingWindDirectionClosingSituation = new HydraRingWindDirectionClosingSituation(
+ hydraRingWindDirection,
+ closingSituation);
- var hydraRingIllustrationPoint =
- new HydraRingFaultTreeIllustrationPoint(" IllustrationPoint",
- random.NextDouble(),
- random.NextEnumValue());
+ var hydraRingIllustrationPoint = new HydraRingFaultTreeIllustrationPoint(
+ "IllustrationPoint",
+ random.NextDouble(),
+ random.NextEnumValue());
var hydraRingIllustrationTreeNode = new HydraRingIllustrationPointTreeNode(hydraRingIllustrationPoint);
double governingWindDirectionAngle = random.NextDouble();
- var governingHydraRingWindDirection = new HydraRingWindDirection("Name", governingWindDirectionAngle);
- var hydraRingGeneralResult =
- new HydraRingGeneralResult(random.NextDouble(),
- governingHydraRingWindDirection,
- Enumerable.Empty(),
- new Dictionary
- {
- {
- hydraRingWindDirectionClosingSituation, hydraRingIllustrationTreeNode
- }
- });
+ var governingHydraRingWindDirection = new HydraRingWindDirection(
+ "Name",
+ governingWindDirectionAngle);
+ var hydraRingGeneralResult = new HydraRingGeneralResult(
+ random.NextDouble(),
+ governingHydraRingWindDirection,
+ Enumerable.Empty(),
+ new Dictionary
+ {
+ {
+ hydraRingWindDirectionClosingSituation, hydraRingIllustrationTreeNode
+ }
+ });
// Call
- GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
+ GeneralResultSubMechanismIllustrationPoint generalResultSubMechanismIllustrationPoint =
GeneralResultSubmechanismIllustrationPointConverter.CreateGeneralResultSubmechanismIllustrationPoint(hydraRingGeneralResult);
// Assert
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs
===================================================================
diff -u -r7f4eb38b0c9023e8a66cbce632cd10a16ef9e4bb -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs (.../SubMechanismIllustrationPointConverterTest.cs) (revision 7f4eb38b0c9023e8a66cbce632cd10a16ef9e4bb)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/SubMechanismIllustrationPointConverterTest.cs (.../SubMechanismIllustrationPointConverterTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -35,7 +35,7 @@
public class SubMechanismIllustrationPointConverterTest
{
[Test]
- public void CreateCreateIllustrationPoint_HydraRingSubMechanismIllustrationPointNull_ThrowsArgumentNullException()
+ public void CreateIllustrationPoint_HydraRingSubMechanismIllustrationPointNull_ThrowsArgumentNullException()
{
// Call
TestDelegate call = () => SubMechanismIllustrationPointConverter.CreateSubMechanismIllustrationPoint(null);
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionConverterTest.cs
===================================================================
diff -u -r7f4eb38b0c9023e8a66cbce632cd10a16ef9e4bb -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionConverterTest.cs (.../WindDirectionConverterTest.cs) (revision 7f4eb38b0c9023e8a66cbce632cd10a16ef9e4bb)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionConverterTest.cs (.../WindDirectionConverterTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -47,8 +47,7 @@
{
// Setup
var random = new Random(21);
- double angle = random.NextDouble();
- var hydraRingWindDirection = new HydraRingWindDirection("name", angle);
+ var hydraRingWindDirection = new HydraRingWindDirection("name", random.NextDouble());
// Call
WindDirection windDirection = WindDirectionConverter.CreateWindDirection(hydraRingWindDirection);
Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs
===================================================================
diff -u -ra5c551a343fee7ea3d7e46dd36c82cf180a1b597 -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision a5c551a343fee7ea3d7e46dd36c82cf180a1b597)
+++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/WaveHeightCalculationServiceTest.cs (.../WaveHeightCalculationServiceTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -25,7 +25,6 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Rhino.Mocks.Constraints;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.TestUtil;
@@ -204,8 +203,7 @@
var mockRepository = new MockRepository();
var calculator = mockRepository.Stub();
- calculator.Expect(c => c.CalculateWithIllustrationPoints(null))
- .Constraints(new TypeOf(typeof(WaveHeightCalculationInput)))
+ calculator.Expect(c => c.CalculateWithIllustrationPoints(Arg.Is.TypeOf))
.Throw(expectedException);
calculator.Stub(c => c.LastErrorFileContent).Return(string.Empty);
calculator.Stub(c => c.OutputDirectory).Return(string.Empty);
@@ -328,152 +326,24 @@
}
[Test]
- public void Calculate_CalculationFailedWithExceptionAndLastErrorPresent_LogErrorAndThrowException()
+ [TestCaseSource(typeof(HydraRingCalculatorTestCaseProvider), nameof(HydraRingCalculatorTestCaseProvider.GetCalculatorFailingConditionsWithReportDetails), new object[]
{
- // Setup
- string validFilePath = Path.Combine(testDataPath, validFile);
-
- const string locationName = "punt_flw_ 1";
- const string calculationName = "calculationName";
- const string calculationFailedMessage = "calculationFailedMessage";
- const double norm = 1.0 / 30;
-
- var calculator = new TestWaveHeightCalculator
- {
- LastErrorFileContent = "An error occurred",
- EndInFailure = true
- };
-
- var mockRepository = new MockRepository();
- var calculatorFactory = mockRepository.StrictMock();
- calculatorFactory.Expect(cf => cf.CreateWaveHeightCalculator(testDataPath)).Return(calculator);
-
- var calculation = mockRepository.Stub();
- calculation.Stub(c => c.Name).Return(locationName);
- calculation.Expect(c => c.Id).Return(0);
- calculation.Expect(c => c.CalculateIllustrationPoints).Return(false);
-
- var calculationMessageProvider = mockRepository.StrictMock();
- calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
- mockRepository.ReplayAll();
-
- using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
- {
- var exceptionThrown = false;
-
- // Call
- Action call = () =>
- {
- try
- {
- new WaveHeightCalculationService().Calculate(calculation,
- validFilePath,
- norm,
- calculationMessageProvider);
- }
- catch (HydraRingCalculationException)
- {
- exceptionThrown = true;
- }
- };
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] msgs = messages.ToArray();
- Assert.AreEqual(4, msgs.Length);
- CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedMessage, msgs[1]);
- StringAssert.StartsWith("Golfhoogte berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
- CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
- });
- Assert.IsTrue(exceptionThrown);
- }
- mockRepository.VerifyAll();
- }
-
- [Test]
- public void Calculate_CalculationFailedWithExceptionAndNoLastErrorPresent_LogErrorAndThrowException()
+ nameof(Run_InvalidCalculation_LogsErrorAndThrowException)
+ })]
+ public void Run_InvalidCalculation_LogsErrorAndThrowException(bool endInFailure, string lastErrorFileContent, string detailedReport)
{
// Setup
string validFilePath = Path.Combine(testDataPath, validFile);
const string locationName = "punt_flw_ 1";
const string calculationName = "calculationName";
- const string calculationFailedUnexplainedMessage = "calculationFailedUnexplainedMessage";
- const double norm = 1.0 / 30;
-
- var calculator = new TestWaveHeightCalculator
- {
- EndInFailure = true
- };
-
- var mockRepository = new MockRepository();
- var calculatorFactory = mockRepository.StrictMock();
- calculatorFactory.Expect(cf => cf.CreateWaveHeightCalculator(testDataPath)).Return(calculator);
-
- var calculation = mockRepository.Stub();
- calculation.Stub(c => c.Name).Return(locationName);
- calculation.Expect(c => c.Id).Return(0);
- calculation.Expect(c => c.CalculateIllustrationPoints).Return(false);
-
- var calculationMessageProvider = mockRepository.StrictMock();
- calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(locationName, calculator.HydraRingCalculationException.Message))
- .Return(calculationFailedUnexplainedMessage);
- mockRepository.ReplayAll();
-
- using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
- {
- var exceptionThrown = false;
-
- // Call
- Action call = () =>
- {
- try
- {
- new WaveHeightCalculationService().Calculate(calculation,
- validFilePath,
- norm,
- calculationMessageProvider);
- }
- catch (HydraRingCalculationException)
- {
- exceptionThrown = true;
- }
- };
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] msgs = messages.ToArray();
- Assert.AreEqual(4, msgs.Length);
- CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedUnexplainedMessage, msgs[1]);
- StringAssert.StartsWith("Golfhoogte berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
- CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
- });
- Assert.IsTrue(exceptionThrown);
- }
- mockRepository.VerifyAll();
- }
-
- [Test]
- public void Calculate_CalculationFailedWithoutExceptionAndWithLastErrorPresent_LogErrorAndThrowException()
- {
- // Setup
- string validFilePath = Path.Combine(testDataPath, validFile);
-
- const string locationName = "punt_flw_ 1";
- const string calculationName = "calculationName";
const string calculationFailedMessage = "calculationFailedMessage";
const double norm = 1.0 / 30;
var calculator = new TestWaveHeightCalculator
{
- LastErrorFileContent = "An error occurred",
- EndInFailure = false
+ LastErrorFileContent = lastErrorFileContent,
+ EndInFailure = endInFailure
};
var mockRepository = new MockRepository();
@@ -487,13 +357,16 @@
var calculationMessageProvider = mockRepository.StrictMock();
calculationMessageProvider.Stub(calc => calc.GetCalculationName(locationName)).Return(calculationName);
- calculationMessageProvider.Stub(calc => calc.GetCalculationFailedMessage(null, null)).IgnoreArguments().Return(calculationFailedMessage);
+ calculationMessageProvider.Expect(calc => calc.GetCalculationFailedMessage(locationName,
+ endInFailure && string.IsNullOrEmpty(lastErrorFileContent)
+ ? calculator.HydraRingCalculationException.Message
+ : lastErrorFileContent
+ )).Return(calculationFailedMessage);
mockRepository.ReplayAll();
using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
{
- var exceptionThrown = false;
- string exceptionMessage = string.Empty;
+ HydraRingCalculationException exception = null;
// Call
Action call = () =>
@@ -507,8 +380,7 @@
}
catch (HydraRingCalculationException e)
{
- exceptionThrown = true;
- exceptionMessage = e.Message;
+ exception = e;
}
};
@@ -518,12 +390,12 @@
string[] msgs = messages.ToArray();
Assert.AreEqual(4, msgs.Length);
CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[0]);
- StringAssert.StartsWith(calculationFailedMessage, msgs[1]);
- StringAssert.StartsWith("Golfhoogte berekening is uitgevoerd op de tijdelijke locatie", msgs[2]);
+ Assert.AreEqual(calculationFailedMessage, msgs[1]);
+ Assert.AreEqual($"Golfhoogte berekening is uitgevoerd op de tijdelijke locatie '{calculator.OutputDirectory}'. " +
+ "Gedetailleerde invoer en uitvoer kan in de bestanden op deze locatie worden gevonden.", msgs[2]);
CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[3]);
});
- Assert.IsTrue(exceptionThrown);
- Assert.AreEqual(calculator.LastErrorFileContent, exceptionMessage);
+ Assert.IsInstanceOf(exception);
}
mockRepository.VerifyAll();
}
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs
===================================================================
diff -u -r8cc644609de02fddbdc3259cebd745e299e7444f -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs (.../DuneLocationTest.cs) (revision 8cc644609de02fddbdc3259cebd745e299e7444f)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs (.../DuneLocationTest.cs) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -22,9 +22,11 @@
using System;
using Core.Common.Base;
using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data.TestUtil;
namespace Ringtoets.DuneErosion.Data.Test
{
@@ -134,12 +136,12 @@
}
[Test]
- [TestCase(CalculationConvergence.CalculatedConverged)]
- [TestCase(CalculationConvergence.CalculatedNotConverged)]
- public void Output_ValidOutput_SetsOutputAndCalculationConvergence(CalculationConvergence converged)
+ public void Output_ValidOutput_SetsOutputAndCalculationConvergence()
{
// Setup
- var duneLocation = new DuneLocation(0, "dune", new Point2D(0, 0), new DuneLocation.ConstructionProperties());
+ var random = new Random(12);
+ var duneLocation = new TestDuneLocation("dune");
+ var converged = random.NextEnumValue();
var output = new DuneLocationOutput(converged,
new DuneLocationOutput.ConstructionProperties());
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj
===================================================================
diff -u -r8aeff3f1153aaac2b2980ca207e298b6d764947b -ref3fadb8742f1c2e60d2278a9d9a4639e1a4f44d
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision 8aeff3f1153aaac2b2980ca207e298b6d764947b)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision ef3fadb8742f1c2e60d2278a9d9a4639e1a4f44d)
@@ -88,6 +88,10 @@
{D1068432-C172-4AA6-847B-D9DEB4C6DE26}
Ringtoets.DuneErosion.Data
+
+ {7BE6B522-02E3-4143-8508-C021A211DE54}
+ Ringtoets.DuneErosion.Data.TestUtil
+