Index: Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/DikeProfile.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rd32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4
--- Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision d32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4)
@@ -32,7 +32,7 @@
///
/// Definition for a dike profile for a failure mechanism.
///
- public class DikeProfile : Observable
+ public sealed class DikeProfile : Observable
{
///
/// Creates a new instance of the class.
Index: Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/RoughnessPoint.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rd32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4
--- Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/RoughnessPoint.cs (.../RoughnessPoint.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/Common/src/Riskeer.Common.Data/DikeProfiles/RoughnessPoint.cs (.../RoughnessPoint.cs) (revision d32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4)
@@ -28,7 +28,7 @@
///
/// This class represents a geometry point with a roughness.
///
- public class RoughnessPoint
+ public sealed class RoughnessPoint
{
///
/// Creates a new instance of the class.
Index: Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/DikeProfileTest.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rd32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4
--- Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision d32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4)
@@ -82,94 +82,111 @@
public void Constructor_WorldReferencePointIsNull_ThrowArgumentNullException()
{
// Call
- TestDelegate call = () => new DikeProfile(null, new RoughnessPoint[0], new Point2D[0],
- null, new DikeProfile.ConstructionProperties
- {
- Id = "id"
- });
+ void Call() => new DikeProfile(null,
+ new RoughnessPoint[0],
+ new Point2D[0],
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id"
+ });
// Assert
- string paramName = Assert.Throws(call).ParamName;
+ string paramName = Assert.Throws(Call).ParamName;
Assert.AreEqual("worldCoordinate", paramName);
}
[Test]
public void Constructor_DikeGeometryNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new DikeProfile(new Point2D(0, 0), null, new Point2D[0],
- null, new DikeProfile.ConstructionProperties
- {
- Id = "id"
- });
+ void Call() => new DikeProfile(new Point2D(0, 0),
+ null,
+ new Point2D[0],
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id"
+ });
// Assert
const string expectedMessage = "De geometrie die opgegeven werd voor het dijkprofiel heeft geen waarde.";
- var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
Assert.AreEqual("points", exception.ParamName);
}
[Test]
public void Constructor_DikeGeometryContainsNullPoint_ThrowsArgumentException()
{
// Call
- TestDelegate call = () => new DikeProfile(new Point2D(0.0, 0.0),
- new RoughnessPoint[]
- {
- null
- },
- new Point2D[0],
- null, new DikeProfile.ConstructionProperties
- {
- Id = "id"
- });
+ void Call() => new DikeProfile(new Point2D(0.0, 0.0),
+ new RoughnessPoint[]
+ {
+ null
+ },
+ new Point2D[0],
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id"
+ });
// Assert
const string expectedMessage = "Een punt in de geometrie voor het dijkprofiel heeft geen waarde.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
}
[Test]
public void Constructor_ForeshoreGeometryNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new DikeProfile(new Point2D(0, 0), new RoughnessPoint[0], null,
- null, new DikeProfile.ConstructionProperties
- {
- Id = "id"
- });
+ void Call() => new DikeProfile(new Point2D(0, 0),
+ new RoughnessPoint[0],
+ null,
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id"
+ });
// Assert
- string paramName = Assert.Throws(call).ParamName;
+ string paramName = Assert.Throws(Call).ParamName;
Assert.AreEqual("geometry", paramName);
}
[Test]
public void Constructor_ForeshoreGeometryContainsNullPoint_ThrowsArgumentException()
{
// Call
- TestDelegate call = () => new DikeProfile(new Point2D(0.0, 0.0), new RoughnessPoint[0],
- new Point2D[]
- {
- null
- }, null, new DikeProfile.ConstructionProperties
- {
- Id = "id"
- });
+ void Call() => new DikeProfile(new Point2D(0.0, 0.0),
+ new RoughnessPoint[0],
+ new Point2D[]
+ {
+ null
+ },
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "id"
+ });
// Assert
const string expectedMessage = "Een punt in de geometrie voor het voorlandprofiel heeft geen waarde.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage);
}
[Test]
public void Constructor_ConstructionPropertiesIsNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new DikeProfile(new Point2D(0, 0), new RoughnessPoint[0], new Point2D[0], null, null);
+ void Call() => new DikeProfile(new Point2D(0, 0),
+ new RoughnessPoint[0],
+ new Point2D[0],
+ null,
+ null);
// Assert
- string paramName = Assert.Throws(call).ParamName;
+ string paramName = Assert.Throws(Call).ParamName;
Assert.AreEqual("properties", paramName);
}
@@ -322,7 +339,7 @@
});
// Call
- string result = dikeProfile.ToString();
+ var result = dikeProfile.ToString();
// Assert
Assert.AreEqual(testName, result);
@@ -335,10 +352,10 @@
DikeProfile dikeProfile = CreateFullyDefinedDikeProfile();
// Call
- TestDelegate call = () => dikeProfile.CopyProperties(null);
+ void Call() => dikeProfile.CopyProperties(null);
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("fromDikeProfile", exception.ParamName);
}
@@ -404,19 +421,13 @@
}
[TestFixture]
- private class DikeProfileEqualsTest : EqualsTestFixture
+ private class DikeProfileEqualsTest : EqualsTestFixture
{
protected override DikeProfile CreateObject()
{
return CreateFullyDefinedDikeProfile();
}
- protected override TestDikeProfile CreateDerivedObject()
- {
- DikeProfile baseProfile = CreateFullyDefinedDikeProfile();
- return new TestDikeProfile(baseProfile);
- }
-
private static IEnumerable GetUnequalTestCases()
{
DikeProfile baseProfile = CreateFullyDefinedDikeProfile();
@@ -603,19 +614,5 @@
return new DikeProfile(worldCoordinate, dikeGeometry, foreshoreGeometry, breakWater, properties);
}
-
- private class TestDikeProfile : DikeProfile
- {
- public TestDikeProfile(DikeProfile profile)
- : base(profile.WorldReferencePoint, profile.DikeGeometry, profile.ForeshoreGeometry, profile.BreakWater,
- new ConstructionProperties
- {
- Name = profile.Name,
- DikeHeight = profile.DikeHeight,
- Id = profile.Id,
- Orientation = profile.Orientation,
- X0 = profile.X0
- }) {}
- }
}
}
\ No newline at end of file
Index: Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs
===================================================================
diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rd32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4
--- Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs (.../RoughnessPointTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1)
+++ Riskeer/Common/test/Riskeer.Common.Data.Test/DikeProfiles/RoughnessPointTest.cs (.../RoughnessPointTest.cs) (revision d32b7ac55fb68c90a2bd6bb883f8a9df307bf2e4)
@@ -51,28 +51,22 @@
[Test]
public void Constructor_PointNull_ThrowsArgumentNullException()
{
- // Setup & Call
- TestDelegate test = () => new RoughnessPoint(null, 0.0);
+ // Call
+ void Call() => new RoughnessPoint(null, 0.0);
// Assert
- var exception = Assert.Throws(test);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("point", exception.ParamName);
}
[TestFixture]
- private class RoughnessPointEqualsTest : EqualsTestFixture
+ private class RoughnessPointEqualsTest : EqualsTestFixture
{
protected override RoughnessPoint CreateObject()
{
return CreateRoughnessPoint();
}
- protected override DerivedRoughnessPoint CreateDerivedObject()
- {
- RoughnessPoint basePoint = CreateRoughnessPoint();
- return new DerivedRoughnessPoint(basePoint);
- }
-
private static IEnumerable GetUnequalTestCases()
{
var random = new Random(21);
@@ -92,11 +86,5 @@
return new RoughnessPoint(new Point2D(0, 0), 3.14);
}
}
-
- private class DerivedRoughnessPoint : RoughnessPoint
- {
- public DerivedRoughnessPoint(RoughnessPoint roughnessPoint)
- : base(roughnessPoint.Point, roughnessPoint.Roughness) {}
- }
}
}
\ No newline at end of file