Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs
===================================================================
diff -u -rfcb1a3246cfb27c4078ffc52215d71a340e02ea7 -r8b05b046823fdcab518defd3335b03f5df8ac4b6
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (.../ExportableAssessmentSection.cs) (revision fcb1a3246cfb27c4078ffc52215d71a340e02ea7)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableAssessmentSection.cs (.../ExportableAssessmentSection.cs) (revision 8b05b046823fdcab518defd3335b03f5df8ac4b6)
@@ -16,20 +16,25 @@
/// The name of the assessment section.
/// The geometry of the assessment section.
/// The assembly result of the assessment section.
+ /// The total assembly result with probability
+ /// of the failure mechanisms.
+ /// The total assembly result without probability
+ /// of the failure mechanisms.
/// The assembly results with probability of failure
/// mechanisms belonging to this assessment section.
/// The assembly results without probability
/// of failure mechanisms belonging to this assessment section.
/// The combined section assembly results
/// of this assessment section.
/// Thrown when any parameter is null.
- public ExportableAssessmentSection(
- string name,
- IEnumerable geometry,
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly,
- IEnumerable> failureMechanismsWithProbability,
- IEnumerable> failureMechanismsWithoutProbability,
- ExportableCombinedSectionAssemblyCollection combinedSectionAssemblyResults)
+ public ExportableAssessmentSection(string name,
+ IEnumerable geometry,
+ ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly,
+ ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyWithProbability,
+ ExportableFailureMechanismAssemblyResult failureMechanismAssemblyWithoutProbability,
+ IEnumerable> failureMechanismsWithProbability,
+ IEnumerable> failureMechanismsWithoutProbability,
+ ExportableCombinedSectionAssemblyCollection combinedSectionAssemblyResults)
{
if (name == null)
{
@@ -46,6 +51,16 @@
throw new ArgumentNullException(nameof(assessmentSectionAssembly));
}
+ if (failureMechanismAssemblyWithProbability == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanismAssemblyWithProbability));
+ }
+
+ if (failureMechanismAssemblyWithoutProbability == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanismAssemblyWithoutProbability));
+ }
+
if (failureMechanismsWithProbability == null)
{
throw new ArgumentNullException(nameof(failureMechanismsWithProbability));
@@ -64,6 +79,8 @@
Name = name;
Geometry = geometry;
AssessmentSectionAssembly = assessmentSectionAssembly;
+ FailureMechanismAssemblyWithProbability = failureMechanismAssemblyWithProbability;
+ FailureMechanismAssemblyWithoutProbability = failureMechanismAssemblyWithoutProbability;
FailureMechanismsWithProbability = failureMechanismsWithProbability;
FailureMechanismsWithoutProbability = failureMechanismsWithoutProbability;
CombinedSectionAssemblyResults = combinedSectionAssemblyResults;
@@ -85,6 +102,16 @@
public ExportableAssessmentSectionAssemblyResult AssessmentSectionAssembly { get; }
///
+ /// Gets the total assembly result of the failure mechanisms with probability.
+ ///
+ public ExportableFailureMechanismAssemblyResultWithProbability FailureMechanismAssemblyWithProbability { get; }
+
+ ///
+ /// Gets the total assembly result of the failure mechanism without probability.
+ ///
+ public ExportableFailureMechanismAssemblyResult FailureMechanismAssemblyWithoutProbability { get; }
+
+ ///
/// Gets the collection of assembly results with probability of failure mechanisms belonging to this assessment section.
///
public IEnumerable> FailureMechanismsWithProbability { get; }
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs
===================================================================
diff -u -r3d0e475d4e70d9b4c8ce5bb5a9735f553d1d4505 -r8b05b046823fdcab518defd3335b03f5df8ac4b6
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision 3d0e475d4e70d9b4c8ce5bb5a9735f553d1d4505)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision 8b05b046823fdcab518defd3335b03f5df8ac4b6)
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Data.Exceptions;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Data.Assembly;
@@ -35,6 +36,8 @@
return new ExportableAssessmentSection(assessmentSection.Name,
assessmentSection.ReferenceLine.Points,
CreateExportableAssessmentSectionAssemblyResult(assessmentSection),
+ CreateExportableFailureMechanismAssemblyResultWithProbability(assessmentSection),
+ CreateExportableFailureMechanismAssemblyResultWithoutProbability(assessmentSection),
CreateExportableFailureMechanismsWithProbability(assessmentSection),
CreateExportableFailureMechanismsWithoutProbability(assessmentSection),
new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(),
@@ -47,8 +50,8 @@
///
/// The assessment section to create a
/// for.
- /// A with assembly results.
- /// Thrown when assembly results cannot be created
+ /// A with assembly result.
+ /// Thrown when assembly result cannot be created
/// for .
private static ExportableAssessmentSectionAssemblyResult CreateExportableAssessmentSectionAssemblyResult(AssessmentSection assessmentSection)
{
@@ -57,6 +60,38 @@
}
///
+ /// Creates a with the assembly result
+ /// based on .
+ ///
+ /// The assessment section to create a
+ /// for.
+ /// A with assembly result.
+ /// Thrown when assembly result cannot be created
+ /// for .
+ private static ExportableFailureMechanismAssemblyResultWithProbability CreateExportableFailureMechanismAssemblyResultWithProbability(AssessmentSection assessmentSection)
+ {
+ FailureMechanismAssembly assemblyResult = AssessmentSectionAssemblyFactory.AssembleFailureMechanismsWithProbability(assessmentSection);
+ return new ExportableFailureMechanismAssemblyResultWithProbability(ExportableAssemblyMethod.WBI2B1,
+ assemblyResult.Group,
+ assemblyResult.Probability);
+ }
+
+ ///
+ /// Creates a with the assembly result
+ /// based on .
+ ///
+ /// The assessment section to create a
+ /// for.
+ /// A with assembly result.
+ /// Thrown when assembly result cannot be created
+ /// for .
+ private static ExportableFailureMechanismAssemblyResult CreateExportableFailureMechanismAssemblyResultWithoutProbability(AssessmentSection assessmentSection)
+ {
+ return new ExportableFailureMechanismAssemblyResult(ExportableAssemblyMethod.WBI2A1,
+ AssessmentSectionAssemblyFactory.AssembleFailureMechanismsWithoutProbability(assessmentSection));
+ }
+
+ ///
/// Creates a collection of
/// for failure mechanisms with an assembly result with a probability based on .
///
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs
===================================================================
diff -u -rfcb1a3246cfb27c4078ffc52215d71a340e02ea7 -r8b05b046823fdcab518defd3335b03f5df8ac4b6
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision fcb1a3246cfb27c4078ffc52215d71a340e02ea7)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableAssessmentSectionTest.cs (.../ExportableAssessmentSectionTest.cs) (revision 8b05b046823fdcab518defd3335b03f5df8ac4b6)
@@ -17,7 +17,6 @@
{
// Setup
IEnumerable geometry = Enumerable.Empty();
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
IEnumerable> failureMechanismsWithProbability =
Enumerable.Empty>();
IEnumerable> failureMechanismsWithoutProbability =
@@ -26,7 +25,9 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(null,
geometry,
- assessmentSectionAssembly,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
failureMechanismsWithProbability,
failureMechanismsWithoutProbability,
CreateCombinedSectionAssemblyCollection());
@@ -40,7 +41,6 @@
public void Constructor_GeometryNull_ThrowsArgumentNullException()
{
// Setup
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
IEnumerable> failureMechanismsWithProbability =
Enumerable.Empty>();
IEnumerable> failureMechanismsWithoutProbability =
@@ -49,7 +49,9 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
null,
- assessmentSectionAssembly,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
failureMechanismsWithProbability,
failureMechanismsWithoutProbability,
CreateCombinedSectionAssemblyCollection());
@@ -73,34 +75,85 @@
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
geometry,
null,
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
failureMechanismsWithProbability,
+ failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("assessmentSectionAssembly", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_FailureMechanismAssemblyWithProbabilityNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ IEnumerable geometry = Enumerable.Empty();
+ IEnumerable> failureMechanismsWithProbability =
+ Enumerable.Empty>();
+ IEnumerable> failureMechanismsWithoutProbability =
+ Enumerable.Empty>();
+
+ // Call
+ TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
+ geometry,
+ CreateAssessmentSectionAssembly(),
+ null,
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
+ failureMechanismsWithProbability,
failureMechanismsWithoutProbability,
CreateCombinedSectionAssemblyCollection());
// Assert
var exception = Assert.Throws(call);
- Assert.AreEqual("assessmentSectionAssembly", exception.ParamName);
+ Assert.AreEqual("failureMechanismAssemblyWithProbability", exception.ParamName);
}
[Test]
- public void Constructor_FailureMechanismsWithProbabilityNull_ThrowsArgumentNullException()
+ public void Constructor_FailureMechanismAssemblyWithoutProbabilityNull_ThrowsArgumentNullException()
{
// Setup
IEnumerable geometry = Enumerable.Empty();
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
+ IEnumerable> failureMechanismsWithProbability =
+ Enumerable.Empty>();
IEnumerable> failureMechanismsWithoutProbability =
Enumerable.Empty>();
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
geometry,
- assessmentSectionAssembly,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
null,
+ failureMechanismsWithProbability,
failureMechanismsWithoutProbability,
CreateCombinedSectionAssemblyCollection());
// Assert
var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismAssemblyWithoutProbability", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_FailureMechanismsWithProbabilityNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ IEnumerable geometry = Enumerable.Empty();
+ IEnumerable> failureMechanismsWithoutProbability =
+ Enumerable.Empty>();
+
+ // Call
+ TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
+ geometry,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
+ null,
+ failureMechanismsWithoutProbability, CreateCombinedSectionAssemblyCollection());
+
+ // Assert
+ var exception = Assert.Throws(call);
Assert.AreEqual("failureMechanismsWithProbability", exception.ParamName);
}
@@ -109,14 +162,15 @@
{
// Setup
IEnumerable geometry = Enumerable.Empty();
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
IEnumerable> failureMechanismsWithProbability =
Enumerable.Empty>();
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
geometry,
- assessmentSectionAssembly,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
failureMechanismsWithProbability,
null,
CreateCombinedSectionAssemblyCollection());
@@ -131,7 +185,6 @@
{
// Setup
IEnumerable geometry = Enumerable.Empty();
- ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
IEnumerable> failureMechanismsWithProbability =
Enumerable.Empty>();
IEnumerable> failureMechanismsWithoutProbability =
@@ -140,7 +193,9 @@
// Call
TestDelegate call = () => new ExportableAssessmentSection(string.Empty,
geometry,
- assessmentSectionAssembly,
+ CreateAssessmentSectionAssembly(),
+ CreateFailureMechanismAssemblyResultWithProbability(),
+ CreateFailureMechanismAssemblyResultWithoutProbability(),
failureMechanismsWithProbability,
failureMechanismsWithoutProbability,
null);
@@ -158,6 +213,8 @@
// Setup
IEnumerable geometry = Enumerable.Empty();
ExportableAssessmentSectionAssemblyResult assessmentSectionAssembly = CreateAssessmentSectionAssembly();
+ ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyResultWithProbability = CreateFailureMechanismAssemblyResultWithProbability();
+ ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResultWithoutProbability = CreateFailureMechanismAssemblyResultWithoutProbability();
IEnumerable> failureMechanismsWithProbability =
Enumerable.Empty>();
IEnumerable> failureMechanismsWithoutProbability =
@@ -168,19 +225,37 @@
var assessmentSection = new ExportableAssessmentSection(name,
geometry,
assessmentSectionAssembly,
+ failureMechanismAssemblyResultWithProbability,
+ failureMechanismAssemblyResultWithoutProbability,
failureMechanismsWithProbability,
- failureMechanismsWithoutProbability,
- combinedSectionAssemblyResults);
+ failureMechanismsWithoutProbability, combinedSectionAssemblyResults);
// Assert
Assert.AreEqual(name, assessmentSection.Name);
Assert.AreSame(geometry, assessmentSection.Geometry);
Assert.AreSame(assessmentSectionAssembly, assessmentSection.AssessmentSectionAssembly);
+ Assert.AreSame(failureMechanismAssemblyResultWithProbability, assessmentSection.FailureMechanismAssemblyWithProbability);
+ Assert.AreSame(failureMechanismAssemblyResultWithoutProbability, assessmentSection.FailureMechanismAssemblyWithoutProbability);
Assert.AreSame(failureMechanismsWithProbability, assessmentSection.FailureMechanismsWithProbability);
Assert.AreSame(failureMechanismsWithoutProbability, assessmentSection.FailureMechanismsWithoutProbability);
Assert.AreSame(combinedSectionAssemblyResults, assessmentSection.CombinedSectionAssemblyResults);
}
+ private static ExportableFailureMechanismAssemblyResult CreateFailureMechanismAssemblyResultWithoutProbability()
+ {
+ var random = new Random(21);
+ return new ExportableFailureMechanismAssemblyResult(random.NextEnumValue(),
+ random.NextEnumValue());
+ }
+
+ private static ExportableFailureMechanismAssemblyResultWithProbability CreateFailureMechanismAssemblyResultWithProbability()
+ {
+ var random = new Random(21);
+ return new ExportableFailureMechanismAssemblyResultWithProbability(random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextDouble());
+ }
+
private static ExportableCombinedSectionAssemblyCollection CreateCombinedSectionAssemblyCollection()
{
return new ExportableCombinedSectionAssemblyCollection(Enumerable.Empty(),
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs
===================================================================
diff -u -r1c2bda6af93900e00924d260e4d18072cdc7f042 -r8b05b046823fdcab518defd3335b03f5df8ac4b6
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision 1c2bda6af93900e00924d260e4d18072cdc7f042)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision 8b05b046823fdcab518defd3335b03f5df8ac4b6)
@@ -85,6 +85,15 @@
Assert.AreEqual(name, exportableAssessmentSection.Name);
CollectionAssert.AreEqual(referenceLine.Points, exportableAssessmentSection.Geometry);
+ ExportableFailureMechanismAssemblyResultWithProbability failureMechanismAssemblyWithProbablity = exportableAssessmentSection.FailureMechanismAssemblyWithProbability;
+ Assert.AreEqual(ExportableAssemblyMethod.WBI2B1, failureMechanismAssemblyWithProbablity.AssemblyMethod);
+ Assert.AreEqual(assessmentSectionAssemblyCalculator.AssembleFailureMechanismsAssemblyOutput.Group, failureMechanismAssemblyWithProbablity.AssemblyCategory);
+ Assert.AreEqual(assessmentSectionAssemblyCalculator.AssembleFailureMechanismsAssemblyOutput.Probability, failureMechanismAssemblyWithProbablity.Probability);
+
+ ExportableFailureMechanismAssemblyResult failureMechanismAssemblyWithoutProbablity = exportableAssessmentSection.FailureMechanismAssemblyWithoutProbability;
+ Assert.AreEqual(ExportableAssemblyMethod.WBI2A1, failureMechanismAssemblyWithoutProbablity.AssemblyMethod);
+ Assert.AreEqual(assessmentSectionAssemblyCalculator.AssembleFailureMechanismsAssemblyCategoryGroupOutput, failureMechanismAssemblyWithoutProbablity.AssemblyCategory);
+
ExportableAssessmentSectionAssemblyResult exportableAssessmentSectionAssemblyResult = exportableAssessmentSection.AssessmentSectionAssembly;
Assert.AreEqual(assessmentSectionAssemblyCalculator.AssembleAssessmentSectionCategoryGroupOutput, exportableAssessmentSectionAssemblyResult.AssemblyCategory);
Assert.AreEqual(ExportableAssemblyMethod.WBI2C1, exportableAssessmentSectionAssemblyResult.AssemblyMethod);