Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assembly/IFailureMechanismSectionAssemblyCalculator.cs
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assembly/IFailureMechanismSectionAssemblyCalculator.cs (.../IFailureMechanismSectionAssemblyCalculator.cs) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assembly/IFailureMechanismSectionAssemblyCalculator.cs (.../IFailureMechanismSectionAssemblyCalculator.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using System.Collections.Generic;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Primitives;
@@ -28,13 +29,6 @@
///
/// Interface representing a failure mechanism section assembly calculator.
///
- ///
- /// This interface is introduced for being able to test the conversion of:
- ///
- /// - Ringtoets failure mechanism section assembly input into kernel input;
- /// - kernel output into Ringtoets failure mechanism section assembly output.
- ///
- ///
public interface IFailureMechanismSectionAssemblyCalculator
{
///
@@ -59,8 +53,12 @@
/// Assembles the detailed assessment based on the input parameters.
///
/// The calculated probability.
- /// The list of categories for this failure mechanism section.
+ /// The collection of categories for this failure mechanism section.
/// A .
+ /// Thrown when
+ /// is null.
+ /// Thrown when
+ /// contains items that are null.
/// Thrown when
/// an error occurs when performing the assembly.
FailureMechanismSectionAssembly AssembleDetailedAssessment(double probability, IEnumerable categories);
@@ -69,9 +67,13 @@
/// Assembles the detailed assessment based on the input parameters.
///
/// The calculated probability.
- /// The list of categories for this failure mechanism section.
+ /// The collection of categories for this failure mechanism section.
/// The 'N' parameter used to factor in the 'length effect'.
/// A .
+ /// Thrown when
+ /// is null.
+ /// Thrown when
+ /// contains items that are null.
/// Thrown when
/// an error occurs when performing the assembly.
FailureMechanismSectionAssembly AssembleDetailedAssessment(double probability,
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs
===================================================================
diff -u -r77413ce11244a9aa8a12fd50aa8cee99bfe54476 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision 77413ce11244a9aa8a12fd50aa8cee99bfe54476)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -48,7 +48,7 @@
/// The signaling norm to calculate with.
/// The lower limit norm to calculate with.
/// The probability distribution factor to calculate with.
- /// The n to calculate with.
+ /// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurs
@@ -62,7 +62,7 @@
/// The signaling norm to calculate with.
/// The lower limit norm to calculate with.
/// The probability distribution factor to calculate with.
- /// The n to calculate with.
+ /// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurs
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryCreator.cs
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryCreator.cs (.../AssemblyCategoryCreator.cs) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/AssemblyCategoryCreator.cs (.../AssemblyCategoryCreator.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -74,6 +74,7 @@
/// An
/// with information taken from the .
/// Thrown when is null.
+ /// Thrown when contains null items.
/// Thrown when
/// is an invalid value.
/// Thrown when
@@ -86,14 +87,19 @@
throw new ArgumentNullException(nameof(output));
}
+ if (output.Result.Contains(null))
+ {
+ throw new ArgumentException(@"Output result cannot contain null items", nameof(output));
+ }
+
return output.Result.Select(
categoriesOutput => new FailureMechanismSectionAssemblyCategory(categoriesOutput.LowerBoundary,
categoriesOutput.UpperBoundary,
ConvertFailureMechanismSectionCategoryGroup(categoriesOutput.CategoryGroup))).ToArray();
}
///
- /// Converts a into a .
+ /// Converts a into a .
///
/// The to convert.
/// A based on .
@@ -128,7 +134,7 @@
}
///
- /// Converts a into a .
+ /// Converts a into a .
///
/// The to convert.
/// A based on .
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionAssemblyCalculatorInputCreator.cs
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionAssemblyCalculatorInputCreator.cs (.../FailureMechanismSectionAssemblyCalculatorInputCreator.cs) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Creators/FailureMechanismSectionAssemblyCalculatorInputCreator.cs (.../FailureMechanismSectionAssemblyCalculatorInputCreator.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -28,6 +28,7 @@
using AssemblyTool.Kernel.Data;
using AssemblyTool.Kernel.Data.AssemblyCategories;
using AssemblyTool.Kernel.Data.CalculationResults;
+using AssemblyTool.Kernel.ErrorHandling;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Primitives;
@@ -109,14 +110,30 @@
/// A collection of to
/// create the input for.
/// The created .
+ /// Thrown when
+ /// is null.
+ /// Thrown when
+ /// contains items that are null.
/// Thrown when contains
/// an invalid .
/// Thrown when contains
/// a valid but unsupported .
+ /// Thrown when any input parameter has an
+ /// invalid value.
public static DetailedCalculationInputFromProbability CreateDetailedCalculationInputFromProbability(
double probability,
IEnumerable categories)
{
+ if (categories == null)
+ {
+ throw new ArgumentNullException(nameof(categories));
+ }
+
+ if (categories.Contains(null))
+ {
+ throw new ArgumentException(@"Categories cannot contain null items.", nameof(categories));
+ }
+
return new DetailedCalculationInputFromProbability(new Probability(probability),
categories.Select(category => new FailureMechanismSectionCategory(
ConvertFailureMechanismSectionAssemblyCategoryGroup(category.Group),
@@ -131,16 +148,31 @@
/// A collection of to
/// create the input for.
/// The 'N' parameter used to factor in the 'length effect'.
- /// The created .
+ /// The created .\Thrown when
+ /// is null.
+ /// Thrown when
+ /// contains items that are null.
/// Thrown when contains
/// an invalid .
/// Thrown when contains
/// a valid but unsupported .
+ /// Thrown when any input parameter has an
+ /// invalid value.
public static DetailedCalculationInputFromProbabilityWithLengthEffect CreateDetailedCalculationInputFromProbabilityWithLengthEffect(
double probability,
IEnumerable categories,
double n)
{
+ if (categories == null)
+ {
+ throw new ArgumentNullException(nameof(categories));
+ }
+
+ if (categories.Contains(null))
+ {
+ throw new ArgumentException(@"Categories cannot contain null items.", nameof(categories));
+ }
+
return new DetailedCalculationInputFromProbabilityWithLengthEffect(
new Probability(probability),
categories.Select(category => new FailureMechanismSectionCategory(
@@ -151,7 +183,7 @@
}
///
- /// Converts a into a .
+ /// Converts a into a .
///
/// The to convert.
/// A based on .
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorTest.cs
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorTest.cs (.../FailureMechanismSectionAssemblyCalculatorTest.cs) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorTest.cs (.../FailureMechanismSectionAssemblyCalculatorTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -115,10 +115,10 @@
TestDelegate test = () => calculator.AssembleSimpleAssessment((SimpleAssessmentResultType) 99);
// Assert
- const string expectedMessage = "The value of argument 'input' (99) is invalid for Enum type 'SimpleAssessmentResultType'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -182,10 +182,10 @@
TestDelegate test = () => calculator.AssembleSimpleAssessment(SimpleAssessmentResultType.AssessFurther);
// Assert
- const string expectedMessage = "The value of argument 'originalGroup' (99) is invalid for Enum type 'FailureMechanismSectionCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -206,8 +206,9 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
- Assert.AreEqual(exception.InnerException.Message, exception.Message);
+ Exception innerException = exception.InnerException;
+ Assert.IsNotNull(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -225,10 +226,10 @@
TestDelegate test = () => calculator.AssembleSimpleAssessment((SimpleAssessmentResultValidityOnlyType) 99);
// Assert
- const string expectedMessage = "The value of argument 'input' (99) is invalid for Enum type 'SimpleAssessmentResultValidityOnlyType'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -292,10 +293,10 @@
TestDelegate test = () => calculator.AssembleSimpleAssessment(SimpleAssessmentResultValidityOnlyType.Applicable);
// Assert
- const string expectedMessage = "The value of argument 'originalGroup' (99) is invalid for Enum type 'FailureMechanismSectionCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -316,7 +317,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
+ Assert.IsNotNull(exception.InnerException);
Assert.AreEqual(exception.InnerException.Message, exception.Message);
}
}
@@ -351,10 +352,10 @@
TestDelegate test = () => calculator.AssembleDetailedAssessment(probability, categories);
// Assert
- const string expectedMessage = "The value of argument 'category' (99) is invalid for Enum type 'FailureMechanismSectionAssemblyCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -366,8 +367,8 @@
double probability = random.NextDouble();
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -402,8 +403,8 @@
double probability = random.NextDouble();
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -432,8 +433,8 @@
double probability = random.NextDouble();
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -450,10 +451,10 @@
TestDelegate test = () => calculator.AssembleDetailedAssessment(probability, categories);
// Assert
- const string expectedMessage = "The value of argument 'originalGroup' (99) is invalid for Enum type 'FailureMechanismSectionCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -465,8 +466,8 @@
double probability = random.NextDouble();
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -483,8 +484,9 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
- Assert.AreEqual(exception.InnerException.Message, exception.Message);
+ Exception innerException = exception.InnerException;
+ Assert.IsNotNull(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -494,7 +496,7 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double n = random.GetFromRange(1.0, 10.0);
var categories = new[]
{
new FailureMechanismSectionAssemblyCategory(random.NextDouble(),
@@ -515,10 +517,10 @@
TestDelegate test = () => calculator.AssembleDetailedAssessment(probability, categories, n);
// Assert
- const string expectedMessage = "The value of argument 'category' (99) is invalid for Enum type 'FailureMechanismSectionAssemblyCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -528,11 +530,11 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double n = random.GetFromRange(1.0, 10.0);
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -566,11 +568,11 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double n = random.GetFromRange(1.0, 10.0);
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -597,11 +599,11 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double n = random.GetFromRange(1.0, 10.0);
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -618,10 +620,10 @@
TestDelegate test = () => calculator.AssembleDetailedAssessment(probability, categories, n);
// Assert
- const string expectedMessage = "The value of argument 'originalGroup' (99) is invalid for Enum type 'FailureMechanismSectionCategoryGroup'.";
var exception = Assert.Throws(test);
- StringAssert.StartsWith(expectedMessage, exception.Message);
- Assert.IsInstanceOf(exception.InnerException);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
@@ -631,11 +633,11 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double n = random.GetFromRange(1.0, 10.0);
var categories = new[]
{
- new FailureMechanismSectionAssemblyCategory(random.NextRoundedDouble(0.0, 0.5),
- random.NextRoundedDouble(0.6, 1.0),
+ new FailureMechanismSectionAssemblyCategory(random.GetFromRange(0.0, 0.5),
+ random.GetFromRange(0.6, 1.0),
FailureMechanismSectionAssemblyCategoryGroup.IIv)
};
@@ -652,8 +654,9 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
- Assert.AreEqual(exception.InnerException.Message, exception.Message);
+ Exception innerException = exception.InnerException;
+ Assert.IsNotNull(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
}
}
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs
===================================================================
diff -u -rb586c7b1f6de605eb04d5c6baeabc7f73d7b0d9d -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (.../AssemblyCategoriesCalculatorTest.cs) (revision b586c7b1f6de605eb04d5c6baeabc7f73d7b0d9d)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Categories/AssemblyCategoriesCalculatorTest.cs (.../AssemblyCategoriesCalculatorTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -137,7 +137,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
+ Assert.IsNotNull(exception.InnerException);
Assert.AreEqual(exception.InnerException.Message, exception.Message);
}
}
@@ -147,8 +147,8 @@
{
// Setup
var random = new Random(11);
- double lowerLimitNorm = random.NextDouble();
- double signalingNorm = random.NextDouble();
+ double lowerLimitNorm = random.GetFromRange(0.5, 1.0);
+ double signalingNorm = random.GetFromRange(0.0, 0.4);
double probabilityDistributionFactor = random.NextDouble();
double n = random.GetFromRange(1, 5);
@@ -223,7 +223,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
+ Assert.IsNotNull(exception.InnerException);
Assert.AreEqual(exception.InnerException.Message, exception.Message);
}
}
@@ -309,7 +309,7 @@
// Assert
var exception = Assert.Throws(test);
- Assert.IsInstanceOf(exception.InnerException);
+ Assert.IsNotNull(exception.InnerException);
Assert.AreEqual(exception.InnerException.Message, exception.Message);
}
}
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryCreatorTest.cs
===================================================================
diff -u -rb586c7b1f6de605eb04d5c6baeabc7f73d7b0d9d -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryCreatorTest.cs (.../AssemblyCategoryCreatorTest.cs) (revision b586c7b1f6de605eb04d5c6baeabc7f73d7b0d9d)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/AssemblyCategoryCreatorTest.cs (.../AssemblyCategoryCreatorTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -55,17 +55,17 @@
var random = new Random(11);
var output = new CalculationOutput(new[]
{
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
null,
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1)))
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1)))
});
// Call
TestDelegate call = () => AssemblyCategoryCreator.CreateAssessmentSectionAssemblyCategories(output);
// Assert
const string expectedMessage = "Output result cannot contain null items";
- var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call,expectedMessage);
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
Assert.AreEqual("output", exception.ParamName);
}
@@ -77,10 +77,10 @@
var output = new CalculationOutput(new[]
{
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1)))
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new AssessmentSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1)))
});
// Call
@@ -145,17 +145,39 @@
}
[Test]
+ public void CreateFailureMechanismSectionAssemblyCategories_OutputContainsNull_ThrowsArgumentException()
+ {
+ // Setup
+ var random = new Random(11);
+ var output = new CalculationOutput(new[]
+ {
+ new FailureMechanismSectionCategory(random.NextEnumValue(),
+ new Probability(random.GetFromRange(0, 0.5)),
+ new Probability(random.GetFromRange(0.5, 1))),
+ null
+ });
+
+ // Call
+ TestDelegate call = () => AssemblyCategoryCreator.CreateFailureMechanismSectionAssemblyCategories(output);
+
+ // Assert
+ const string expectedMessage = "Output result cannot contain null items";
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
public void CreateFailureMechanismSectionAssemblyCategories_WithOutput_ReturnFailureMechanismSectionAssemblyCategoryResult()
{
// Setup
var random = new Random(11);
var output = new CalculationOutput(new[]
{
- new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1))),
- new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5 ,1)))
+ new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1))),
+ new FailureMechanismSectionCategory(random.NextEnumValue(), new Probability(random.GetFromRange(0, 0.5)), new Probability(random.GetFromRange(0.5, 1)))
});
// Call
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionAssemblyCalculatorInputCreatorTest.cs
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionAssemblyCalculatorInputCreatorTest.cs (.../FailureMechanismSectionAssemblyCalculatorInputCreatorTest.cs) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Creators/FailureMechanismSectionAssemblyCalculatorInputCreatorTest.cs (.../FailureMechanismSectionAssemblyCalculatorInputCreatorTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -110,6 +110,36 @@
}
[Test]
+ public void CreateDetailedCalculationInputFromProbability_CategoriesContainsNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => FailureMechanismSectionAssemblyCalculatorInputCreator.CreateDetailedCalculationInputFromProbability(
+ new Random(39).NextDouble(),
+ new FailureMechanismSectionAssemblyCategory[]
+ {
+ null
+ });
+
+ // Assert
+ const string expectedMessage = "Categories cannot contain null items.";
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ Assert.AreEqual("categories", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateDetailedCalculationInputFromProbability_CategoriesNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => FailureMechanismSectionAssemblyCalculatorInputCreator.CreateDetailedCalculationInputFromProbability(
+ new Random(39).NextDouble(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("categories", exception.ParamName);
+ }
+
+ [Test]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.NotApplicable, FailureMechanismCategoryGroup.NotApplicable)]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.None, FailureMechanismSectionCategoryGroup.None)]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.Iv, FailureMechanismSectionCategoryGroup.Iv)]
@@ -126,8 +156,8 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double lowerBoundary = random.NextRoundedDouble(0.0, 0.5);
- double upperBoundary = random.NextRoundedDouble(0.6, 1.0);
+ double lowerBoundary = random.GetFromRange(0.0, 0.5);
+ double upperBoundary = random.GetFromRange(0.6, 1.0);
// Call
DetailedCalculationInputFromProbability result =
@@ -170,8 +200,45 @@
const string expectedMessage = "The value of argument 'category' (99) is invalid for Enum type 'FailureMechanismSectionAssemblyCategoryGroup'.";
TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
}
+
+ [Test]
+ public void CreateDetailedCalculationInputFromProbabilityWithLengthEffect_CategoriesContainsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var random = new Random(39);
+ // Call
+ TestDelegate test = () => FailureMechanismSectionAssemblyCalculatorInputCreator.CreateDetailedCalculationInputFromProbabilityWithLengthEffect(
+ random.NextDouble(),
+ new FailureMechanismSectionAssemblyCategory[]
+ {
+ null
+ },
+ random.NextDouble());
+
+ // Assert
+ const string expectedMessage = "Categories cannot contain null items.";
+ var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ Assert.AreEqual("categories", exception.ParamName);
+ }
+
[Test]
+ public void CreateDetailedCalculationInputFromProbabilityWithLengthEffect_CategoriesNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var random = new Random(39);
+
+ // Call
+ TestDelegate test = () => FailureMechanismSectionAssemblyCalculatorInputCreator.CreateDetailedCalculationInputFromProbabilityWithLengthEffect(
+ random.NextDouble(),
+ null,
+ random.NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("categories", exception.ParamName);
+ }
+ [Test]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.NotApplicable, FailureMechanismCategoryGroup.NotApplicable)]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.None, FailureMechanismSectionCategoryGroup.None)]
[TestCase(FailureMechanismSectionAssemblyCategoryGroup.Iv, FailureMechanismSectionCategoryGroup.Iv)]
@@ -188,9 +255,9 @@
// Setup
var random = new Random(39);
double probability = random.NextDouble();
- double lowerBoundary = random.NextRoundedDouble(0.0, 0.5);
- double upperBoundary = random.NextRoundedDouble(0.6, 1.0);
- double n = random.NextRoundedDouble(1.0, 10.0);
+ double lowerBoundary = random.GetFromRange(0.0, 0.5);
+ double upperBoundary = random.GetFromRange(0.6, 1.0);
+ double n = random.GetFromRange(1.0, 10.0);
// Call
DetailedCalculationInputFromProbabilityWithLengthEffect result =
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj
===================================================================
diff -u -r65088ddf1c49c4df81c8129a7e0ca158455c4281 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision 65088ddf1c49c4df81c8129a7e0ca158455c4281)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Ringtoets.AssemblyTool.KernelWrapper.Test.csproj (.../Ringtoets.AssemblyTool.KernelWrapper.Test.csproj) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -38,18 +38,10 @@
-
- {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
- Core.Common.Base
-
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
-
- {d4200f43-3f72-4f42-af0a-8ced416a38ec}
- Ringtoets.Common.Data
-
{78AA56F5-431D-465C-AC50-3173D7E90AC1}
Ringtoets.Common.Primitives
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs
===================================================================
diff -u -r7cccb012b51218b8989007633d8338eaf435d6f4 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs (.../FailureMechanismSectionAssemblyCalculatorStubTest.cs) (revision 7cccb012b51218b8989007633d8338eaf435d6f4)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs (.../FailureMechanismSectionAssemblyCalculatorStubTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -54,7 +54,7 @@
#region Simple Assessment
[Test]
- public void AssembleSimpleAssessment_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ public void AssembleSimpleAssessment_ThrowExceptionOnCalculateFalse_ReturnOutput()
{
// Setup
var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
@@ -100,7 +100,7 @@
}
[Test]
- public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateFalse_ReturnOutput()
{
// Setup
var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
@@ -150,7 +150,7 @@
#region Detailed Assessment
[Test]
- public void AssembleDetailedAssessment_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ public void AssembleDetailedAssessment_ThrowExceptionOnCalculateFalse_ReturnOutput()
{
// Setup
var random = new Random(39);
@@ -179,6 +179,9 @@
double probability = random.NextDouble();
double lowerBoundary = random.NextDouble();
double upperBoundary = random.NextDouble();
+ var assemblyCategory = new FailureMechanismSectionAssemblyCategory(lowerBoundary,
+ upperBoundary,
+ FailureMechanismSectionAssemblyCategoryGroup.IIv);
var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
@@ -187,18 +190,12 @@
probability,
new[]
{
- new FailureMechanismSectionAssemblyCategory(lowerBoundary,
- upperBoundary,
- FailureMechanismSectionAssemblyCategoryGroup.IIv)
+ assemblyCategory
});
// Assert
Assert.AreEqual(probability, calculator.DetailedAssessmentProbabilityInput);
-
- FailureMechanismSectionAssemblyCategory actualSectionCategory = calculator.DetailedAssessmentCategoriesInput.Single();
- Assert.AreEqual(lowerBoundary, actualSectionCategory.LowerBoundary);
- Assert.AreEqual(upperBoundary, actualSectionCategory.UpperBoundary);
- Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, actualSectionCategory.Group);
+ Assert.AreSame(assemblyCategory, calculator.DetailedAssessmentCategoriesInput.Single());
}
[Test]
@@ -228,7 +225,7 @@
}
[Test]
- public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateFalse_ReturnOutput()
{
// Setup
var random = new Random(39);
@@ -259,6 +256,9 @@
double lowerBoundary = random.NextRoundedDouble(0.0, 0.5);
double upperBoundary = random.NextRoundedDouble(0.6, 1.0);
double n = random.NextRoundedDouble(1.0, 10.0);
+ var assemblyCategory = new FailureMechanismSectionAssemblyCategory(lowerBoundary,
+ upperBoundary,
+ FailureMechanismSectionAssemblyCategoryGroup.IIv);
var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
@@ -267,20 +267,16 @@
probability,
new[]
{
- new FailureMechanismSectionAssemblyCategory(lowerBoundary,
- upperBoundary,
- FailureMechanismSectionAssemblyCategoryGroup.IIv)
+ assemblyCategory
},
n);
// Assert
Assert.AreEqual(probability, calculator.DetailedAssessmentProbabilityInput);
Assert.AreEqual(n, calculator.DetailedAssessmentNInput);
- FailureMechanismSectionAssemblyCategory actualSectionCategory = calculator.DetailedAssessmentCategoriesInput.Single();
- Assert.AreEqual(lowerBoundary, actualSectionCategory.LowerBoundary);
- Assert.AreEqual(upperBoundary, actualSectionCategory.UpperBoundary);
- Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, actualSectionCategory.Group);
+ Assert.AreSame(assemblyCategory, calculator.DetailedAssessmentCategoriesInput.Single());
+
}
[Test]
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs
===================================================================
diff -u -rb46cba3269d292e5ca3374ec0f75810686cf3ec6 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision b46cba3269d292e5ca3374ec0f75810686cf3ec6)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -42,6 +42,8 @@
Assert.IsInstanceOf(calculator);
Assert.IsNull(calculator.AssessmentSectionCategoriesOutput);
Assert.IsNull(calculator.FailureMechanismSectionCategoriesOutput);
+ Assert.AreEqual(0.0, calculator.SignalingNorm);
+ Assert.AreEqual(0.0, calculator.LowerLimitNorm);
}
[Test]
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs
===================================================================
diff -u -r7cccb012b51218b8989007633d8338eaf435d6f4 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs (.../FailureMechanismSectionAssemblyCalculatorStub.cs) (revision 7cccb012b51218b8989007633d8338eaf435d6f4)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs (.../FailureMechanismSectionAssemblyCalculatorStub.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -48,7 +48,7 @@
public SimpleAssessmentResultValidityOnlyType SimpleAssessmentValidityOnlyInput { get; private set; }
///
- /// Gets or sets the output of the detailed assessment calculation.
+ /// Gets the output of the detailed assessment calculation.
///
public FailureMechanismSectionAssembly DetailedAssessmentAssemblyOutput { get; private set; }
@@ -68,7 +68,7 @@
public double DetailedAssessmentNInput { get; private set; }
///
- /// Gets or sets an indicator whether an exception must be thrown when performing a calculation.
+ /// Sets an indicator whether an exception must be thrown when performing a calculation.
///
public bool ThrowExceptionOnCalculate { private get; set; }
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../ClosingStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../ClosingStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -32,7 +32,7 @@
namespace Ringtoets.ClosingStructures.Data
{
///
- /// Factory for creating assembly results for closing structures failure mechanism section results.
+ /// Factory for assembling assembly results for closing structures failure mechanism section results.
///
public static class ClosingStructuresFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs
===================================================================
diff -u -r739752c5cc7ed800dacf74e12221c227183ddc6f -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../ClosingStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 739752c5cc7ed800dacf74e12221c227183ddc6f)
+++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../ClosingStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -35,8 +35,8 @@
/// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
///
/// The section result to get the detailed assessment probability for.
- /// The failure mechanism the calculations belong to.
- /// The assessment section the calculations belong to.
+ /// The failure mechanism the section result belongs to.
+ /// The assessment section the section result belongs to.
/// The calculated detailed assessment probability; or when there is no
/// calculation assigned to the section result or the calculation is not performed.
/// Thrown when any parameter is null.
Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -29,6 +29,7 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
@@ -186,26 +187,18 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new ClosingStructuresFailureMechanism();
- var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
ClosingStructuresFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
@@ -216,7 +209,11 @@
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(failureMechanism, assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.GeneralInput.N, categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -225,20 +222,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -255,27 +244,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -294,6 +276,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyToolCategoriesFactory.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyToolCategoriesFactory.cs (.../AssemblyToolCategoriesFactory.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/AssemblyTool/AssemblyToolCategoriesFactory.cs (.../AssemblyToolCategoriesFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -61,7 +61,7 @@
/// The signaling norm to use in the calculation.
/// The lower limit norm to use in the calculation.
/// The probability distribution factor to calculate with.
- /// The n to calculate with.
+ /// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurred while creating the categories.
@@ -93,7 +93,7 @@
/// The signaling norm to use in the calculation.
/// The lower limit norm to use in the calculation.
/// The probability distribution factor to calculate with.
- /// The n to calculate with.
+ /// The 'N' parameter used to factor in the 'length effect'.
/// An with categories of
/// .
/// Thrown when an error occurred while creating the categories.
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -1,4 +1,25 @@
-//------------------------------------------------------------------------------
+// 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.
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -32,7 +32,7 @@
namespace Ringtoets.GrassCoverErosionInwards.Data
{
///
- /// Factory for creating assembly results for grass cover erosion inwards failure mechanism section results.
+ /// Factory for assembling assembly results for closing structures failure mechanism section results.
///
public static class GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultDetailedAssessmentExtensions.cs
===================================================================
diff -u -r739752c5cc7ed800dacf74e12221c227183ddc6f -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 739752c5cc7ed800dacf74e12221c227183ddc6f)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -35,8 +35,8 @@
/// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
///
/// The section result to get the detailed assessment probability for.
- /// The failure mechanism the calculations belong to.
- /// The assessment section the calculations belong to.
+ /// The failure mechanism the section result belongs to.
+ /// The assessment section the section result belongs to.
/// The calculated detailed assessment probability or when there is no
/// calculation assigned to the section result or the calculation is not performed.
/// Thrown when any parameter is null.
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Linq;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -29,8 +28,8 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
@@ -186,26 +185,18 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
GrassCoverErosionInwardsFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
@@ -216,7 +207,11 @@
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(failureMechanism, assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.GeneralInput.N, categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -225,20 +220,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -255,27 +242,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -294,6 +274,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../HeightStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../HeightStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -32,7 +32,7 @@
namespace Ringtoets.HeightStructures.Data
{
///
- /// Factory for creating assembly results for height structures failure mechanism section results.
+ /// Factory for assembling assembly results for height structures failure mechanism section results.
///
public static class HeightStructuresFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs
===================================================================
diff -u -r739752c5cc7ed800dacf74e12221c227183ddc6f -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 739752c5cc7ed800dacf74e12221c227183ddc6f)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../HeightStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -35,8 +35,8 @@
/// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
///
/// The section result to get the detailed assessment probability for.
- /// The failure mechanism the calculations belong to.
- /// The assessment section the calculations belong to.
+ /// The failure mechanism the section result belongs to.
+ /// The assessment section the section result belongs to.
/// The calculated detailed assessment probability; or when there is no
/// calculation assigned to the section result or the calculation is not performed.
/// Thrown when any parameter is null.
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../HeightStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../HeightStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Linq;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -29,8 +28,8 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
@@ -186,26 +185,18 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new HeightStructuresFailureMechanism();
- var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
HeightStructuresFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
@@ -216,7 +207,11 @@
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(failureMechanism, assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.GeneralInput.N, categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -225,20 +220,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -255,27 +242,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -294,6 +274,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.cs (.../MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.cs (.../MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -33,7 +33,7 @@
namespace Ringtoets.MacroStabilityInwards.Data
{
///
- /// Factory for creating assembly results for macro stability inwards failure mechanism section results.
+ /// Factory for assembling assembly results for piping failure mechanism section results.
///
public static class MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -29,8 +29,8 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Probability;
@@ -211,48 +211,46 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+ var calculationScenarios = new[]
{
- SimpleAssessmentResult = random.NextEnumValue()
+ MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput()
};
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
+
MacroStabilityInwardsFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
sectionResult,
- new[]
- {
- MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput()
- },
+ calculationScenarios,
failureMechanism,
assessmentSection);
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(
- new[]
- {
- MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput()
- },
+ calculationScenarios,
failureMechanism,
assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.GetN(sectionResult.Section.Length), calculator.DetailedAssessmentNInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.GetN(sectionResult.Section.Length),
+ calculator.DetailedAssessmentNInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.GetN(
+ failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.SectionLength),
+ categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -261,20 +259,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -295,27 +285,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -338,6 +321,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs
===================================================================
diff -u -r9871a2374e0f08658f7bec58412958b35f8a849b -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision 9871a2374e0f08658f7bec58412958b35f8a849b)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs (.../MacroStabilityInwardsFailureMechanismSectionResultRowTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -162,123 +162,6 @@
}
[Test]
- public void DetailedAssessmentProbability_NoScenarios_ReturnNaN()
- {
- // Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
-
- FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
- var result = new MacroStabilityInwardsFailureMechanismSectionResult(section);
-
- // Call
- var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, Enumerable.Empty(),
- failureMechanism, assessmentSection);
-
- // Assert
- Assert.IsNaN(row.DetailedAssessmentProbability);
- mocks.VerifyAll();
- }
-
- [Test]
- [TestCase(0.2, 0.8 - 1e5)]
- [TestCase(0.0, 0.5)]
- [TestCase(0.3, 0.7 + 1e-5)]
- [TestCase(-5, -8)]
- [TestCase(13, 2)]
- public void DetailedAssessmentProbability_RelevantScenarioContributionDontAddUpTo1_ReturnNaN(double contributionA, double contributionB)
- {
- // Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
-
- FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
-
- MacroStabilityInwardsCalculationScenario scenarioA =
- MacroStabilityInwardsCalculationScenarioTestFactory.CreateNotCalculatedMacroStabilityInwardsCalculationScenario(section);
- MacroStabilityInwardsCalculationScenario scenarioB =
- MacroStabilityInwardsCalculationScenarioTestFactory.CreateNotCalculatedMacroStabilityInwardsCalculationScenario(section);
- scenarioA.Contribution = (RoundedDouble) contributionA;
- scenarioB.Contribution = (RoundedDouble) contributionB;
-
- var result = new MacroStabilityInwardsFailureMechanismSectionResult(section);
- var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, new[]
- {
- scenarioA,
- scenarioB
- }, failureMechanism, assessmentSection);
-
- // Call
- double detailedAssessmentProbability = row.DetailedAssessmentProbability;
-
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
- }
-
- [Test]
- public void DetailedAssessmentProbability_NoRelevantScenariosDone_ReturnNaN()
- {
- // Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
-
- FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
-
- MacroStabilityInwardsCalculationScenario scenario = MacroStabilityInwardsCalculationScenarioTestFactory.CreateNotCalculatedMacroStabilityInwardsCalculationScenario(section);
-
- var result = new MacroStabilityInwardsFailureMechanismSectionResult(section);
- var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, new[]
- {
- scenario
- }, failureMechanism, assessmentSection);
-
- // Call
- double detailedAssessmentProbability = row.DetailedAssessmentProbability;
-
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
- }
-
- [Test]
- public void DetailedAssessmentProbability_NoRelevantScenarios_ReturnNaN()
- {
- // Setup
- var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- mocks.ReplayAll();
-
- var failureMechanism = new MacroStabilityInwardsFailureMechanism();
-
- FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
-
- MacroStabilityInwardsCalculationScenario scenario = MacroStabilityInwardsCalculationScenarioTestFactory.CreateIrrelevantMacroStabilityInwardsCalculationScenario(section);
-
- var result = new MacroStabilityInwardsFailureMechanismSectionResult(section);
- var row = new MacroStabilityInwardsFailureMechanismSectionResultRow(result, new[]
- {
- scenario
- }, failureMechanism, assessmentSection);
-
- // Call
- double detailedAssessmentProbability = row.DetailedAssessmentProbability;
-
- // Assert
- Assert.IsNaN(detailedAssessmentProbability);
- mocks.VerifyAll();
- }
-
- [Test]
public void DetailedAssessmentProbability_RelevantScenariosDone_ResultOfSection()
{
// Setup
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResultAssemblyFactory.cs (.../PipingFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismSectionResultAssemblyFactory.cs (.../PipingFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -33,7 +33,7 @@
namespace Ringtoets.Piping.Data
{
///
- /// Factory for creating assembly results for piping failure mechanism section results.
+ /// Factory for assembling assembly results for piping failure mechanism section results.
///
public static class PipingFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultAssemblyFactoryTest.cs (.../PipingFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismSectionResultAssemblyFactoryTest.cs (.../PipingFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -29,8 +29,8 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Probability;
@@ -212,48 +212,46 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new PipingFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new PipingFailureMechanism();
- var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+ var calculationScenarios = new[]
{
- SimpleAssessmentResult = random.NextEnumValue()
+ PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput()
};
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
+
PipingFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
sectionResult,
- new[]
- {
- PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput()
- },
+ calculationScenarios,
failureMechanism,
assessmentSection);
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(
- new[]
- {
- PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput()
- },
+ calculationScenarios,
failureMechanism,
assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.AreEqual(failureMechanism.PipingProbabilityAssessmentInput.GetN(sectionResult.Section.Length), calculator.DetailedAssessmentNInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(failureMechanism.PipingProbabilityAssessmentInput.GetN(sectionResult.Section.Length),
+ calculator.DetailedAssessmentNInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.PipingProbabilityAssessmentInput.GetN(
+ failureMechanism.PipingProbabilityAssessmentInput.SectionLength),
+ categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -262,20 +260,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new PipingFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -296,27 +286,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new PipingFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new PipingFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -339,6 +322,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r5530fd1bc0d417f35463e60e8ce198c14aad75e1 -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision 5530fd1bc0d417f35463e60e8ce198c14aad75e1)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.cs (.../StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -32,7 +32,7 @@
namespace Ringtoets.StabilityPointStructures.Data
{
///
- /// Factory for creating assembly results for stability point structures failure mechanism section results.
+ /// Factory for assembling assembly results for stability point structures failure mechanism section results.
///
public static class StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory
{
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs
===================================================================
diff -u -r739752c5cc7ed800dacf74e12221c227183ddc6f -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../StabilityPointStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision 739752c5cc7ed800dacf74e12221c227183ddc6f)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs (.../StabilityPointStructuresFailureMechanismSectionResultDetailedAssessmentExtensions.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -35,8 +35,8 @@
/// Gets the value for the detailed assessment of safety per failure mechanism section as a probability.
///
/// The section result to get the detailed assessment probability for.
- /// The failure mechanism the calculations belong to.
- /// The assessment section the calculations belong to.
+ /// The failure mechanism the section result belongs to.
+ /// The assessment section the section result belongs to.
/// The calculated detailed assessment probability; or when there is no
/// calculation assigned to the section result or the calculation is not performed.
/// Thrown when any parameter is null.
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -rcb4699ab3f0ba6a23e21650ec8cec52d82d0777b
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision cb4699ab3f0ba6a23e21650ec8cec52d82d0777b)
@@ -20,7 +20,6 @@
// All rights reserved.
using System;
-using System.Linq;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -29,8 +28,8 @@
using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.Data.Contribution;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
@@ -186,26 +185,18 @@
public void AssembleDetailedAssembly_WithInput_SetsInputOnCalculator()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var failureMechanism = new StabilityPointStructuresFailureMechanism();
- var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
- var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ AssemblyCategoriesCalculatorStub categoryCalculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
// Call
StabilityPointStructuresFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly(
@@ -216,7 +207,11 @@
// Assert
Assert.AreEqual(sectionResult.GetDetailedAssessmentProbability(failureMechanism, assessmentSection),
calculator.DetailedAssessmentProbabilityInput);
- Assert.IsNotNull(calculator.DetailedAssessmentCategoriesInput);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.SignalingNorm, categoryCalculator.SignalingNorm);
+ Assert.AreEqual(assessmentSection.FailureMechanismContribution.LowerLimitNorm, categoryCalculator.LowerLimitNorm);
+ Assert.AreEqual(failureMechanism.Contribution, categoryCalculator.ProbabilityDistributionFactor);
+ Assert.AreEqual(failureMechanism.GeneralInput.N, categoryCalculator.N);
+ Assert.AreSame(categoryCalculator.FailureMechanismSectionCategoriesOutput, calculator.DetailedAssessmentCategoriesInput);
mocks.VerifyAll();
}
}
@@ -225,20 +220,12 @@
public void AssembleDetailedAssembly_AssemblyRan_ReturnsOutput()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -255,27 +242,20 @@
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput;
Assert.AreSame(calculatorOutput, actualOutput);
+ mocks.VerifyAll();
}
}
[Test]
public void AssembleDetailedAssembly_CalculatorThrowsExceptions_ThrowsAssemblyException()
{
// Setup
- var random = new Random(21);
var mocks = new MockRepository();
- var assessmentSection = mocks.Stub();
- assessmentSection.Stub(a => a.FailureMechanismContribution).Return(new FailureMechanismContribution(
- Enumerable.Empty(),
- random.Next(0, 100),
- random.NextRoundedDouble(0.06, 0.1),
- random.NextRoundedDouble(0.00001, 0.05)));
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks);
mocks.ReplayAll();
- var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
- {
- SimpleAssessmentResult = random.NextEnumValue()
- };
+ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -294,6 +274,7 @@
Exception innerException = exception.InnerException;
Assert.IsInstanceOf(innerException);
Assert.AreEqual(innerException.Message, exception.Message);
+ mocks.VerifyAll();
}
}