Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Contribution/FailureMechanismContributionTest.cs =================================================================== diff -u -ra1bfcaebf502a6dca18c0256d692e8c94130327a -r974fb1eadbd8a630c7a992648ad42ac85ec205b1 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Contribution/FailureMechanismContributionTest.cs (.../FailureMechanismContributionTest.cs) (revision a1bfcaebf502a6dca18c0256d692e8c94130327a) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Contribution/FailureMechanismContributionTest.cs (.../FailureMechanismContributionTest.cs) (revision 974fb1eadbd8a630c7a992648ad42ac85ec205b1) @@ -79,6 +79,7 @@ } [Test] + [SetCulture("nl-NL")] public void Constructor_WithInvalidNorm_ThrowsArgumentOutOfRangeException( [Values(150, 1 + 1e-6, -1e-6, -150, double.NaN)] double norm) { @@ -90,15 +91,17 @@ TestDelegate test = () => new FailureMechanismContribution(Enumerable.Empty(), contribution, norm); // Assert - const string expectedMessage = "Kans moet in het bereik [0, 1] liggen."; + const string expectedMessage = "Kans moet in het bereik [0,0, 1,0] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } [Test] + [SetCulture("nl-NL")] [TestCase(-10)] [TestCase(-1e-6)] [TestCase(100 + 1e-6)] [TestCase(150)] + [TestCase(double.NaN)] public void Constructor_OtherContributionLessOrEqualTo0OrGreaterThan100_ArgumentException(double contribution) { // Setup @@ -109,7 +112,7 @@ TestDelegate test = () => new FailureMechanismContribution(Enumerable.Empty(), contribution, norm); // Assert - const string expectedMessage = "De waarde voor de toegestane bijdrage aan de faalkans moet in het bereik [0, 100] liggen."; + const string expectedMessage = "De waarde voor de toegestane bijdrage aan de faalkans moet in het bereik [0,0, 100,0] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } @@ -181,7 +184,7 @@ CollectionAssert.AreEqual(failureMechanismNames, result.Distribution.Select(d => d.Assessment)); CollectionAssert.AreEqual(failureMechanismContributions, result.Distribution.Select(d => d.Contribution)); - CollectionAssert.AreEqual(failureMechanismContributions.Select(c => 100.0/(norm*c)), result.Distribution.Select(d => d.ProbabilitySpace)); + CollectionAssert.AreEqual(failureMechanismContributions.Select(c => 100.0 / (norm * c)), result.Distribution.Select(d => d.ProbabilitySpace)); var expectedIsAlwaysRelevant = Enumerable.Repeat(false, failureMechanismCount) .Concat(Enumerable.Repeat(true, 1)); CollectionAssert.AreEqual(expectedIsAlwaysRelevant, result.Distribution.Select(d => d.IsAlwaysRelevant)); @@ -193,7 +196,7 @@ { // Setup IEnumerable failureMechanisms = Enumerable.Empty(); - const double norm = 1.0/30000; + const double norm = 1.0 / 30000; var failureMechanismContribution = new FailureMechanismContribution(failureMechanisms, 12.34, norm); // Call @@ -213,7 +216,7 @@ // Setup IEnumerable failureMechanisms = Enumerable.Empty(); - const double norm = 1.0/30000; + const double norm = 1.0 / 30000; var failureMechanismContribution = new FailureMechanismContribution(failureMechanisms, 12.34, norm); // Call @@ -285,7 +288,7 @@ failureMechanism2 }; - const double norm = 1.0/30000; + const double norm = 1.0 / 30000; const double otherContribution = 12.34; var failureMechanismContribution = new FailureMechanismContribution(failureMechanisms, otherContribution, norm); @@ -338,6 +341,7 @@ } [Test] + [SetCulture("nl-NL")] public void Norm_InvalidNewNorm_ThrowsArgumentOutOfRangeException( [Values(150, 1 + 1e-6, -1e-6, -150, double.NaN)] double newNorm) { @@ -351,7 +355,7 @@ TestDelegate test = () => failureMechanismContribution.Norm = newNorm; // Assert - const string expectedMessage = "Kans moet in het bereik [0, 1] liggen."; + const string expectedMessage = "Kans moet in het bereik [0,0, 1,0] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); } @@ -361,8 +365,8 @@ // Setup var random = new Random(21); var otherContribution = random.Next(1, 100); - const double norm = 1.0/20000; - const double newNorm = 1.0/30000; + const double norm = 1.0 / 20000; + const double newNorm = 1.0 / 30000; var failureMechanism = mockRepository.Stub(); @@ -383,7 +387,7 @@ private static void AssertFailureProbabilitySpace(double newOtherContribution, double norm, double probabilitySpace) { - double expectedProbabilitySpace = 100.0/(norm*newOtherContribution); + double expectedProbabilitySpace = 100.0 / (norm * newOtherContribution); Assert.AreEqual(expectedProbabilitySpace, probabilitySpace); } }