Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs
===================================================================
diff -u -r0fd76a0bde626efdb5058ada2df39285ca4333cf -r999594396502871b85138c2d1d49912ddb0e102a
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs (.../ExportableFailureMechanismFactory.cs) (revision 0fd76a0bde626efdb5058ada2df39285ca4333cf)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs (.../ExportableFailureMechanismFactory.cs) (revision 999594396502871b85138c2d1d49912ddb0e102a)
@@ -17,9 +17,10 @@
/// The of the failure mechanism.
/// The assembly method which is used to obtain the general assembly result of the failure mechanism.
/// A with default values.
- public static ExportableFailureMechanism CreateDefaultExportableFailureMechanismWithProbability(ExportableFailureMechanismType failureMechanismCode,
- ExportableFailureMechanismGroup failureMechanismGroup,
- ExportableAssemblyMethod assemblyMethod)
+ public static ExportableFailureMechanism CreateDefaultExportableFailureMechanismWithProbability(
+ ExportableFailureMechanismType failureMechanismCode,
+ ExportableFailureMechanismGroup failureMechanismGroup,
+ ExportableAssemblyMethod assemblyMethod)
{
return new ExportableFailureMechanism(
new ExportableFailureMechanismAssemblyResultWithProbability(assemblyMethod,
@@ -30,5 +31,27 @@
failureMechanismCode,
failureMechanismGroup);
}
+
+ ///
+ /// Creates a default instance of a
+ /// without a probability based on its input parameters.
+ ///
+ /// The of the failure mechanism.
+ /// The of the failure mechanism.
+ /// The assembly method which is used to obtain the general assembly result of the failure mechanism.
+ /// A with default values.
+ public static ExportableFailureMechanism CreateDefaultExportableFailureMechanismWithoutProbability(
+ ExportableFailureMechanismType failureMechanismCode,
+ ExportableFailureMechanismGroup failureMechanismGroup,
+ ExportableAssemblyMethod assemblyMethod)
+ {
+ return new ExportableFailureMechanism(
+ new ExportableFailureMechanismAssemblyResult(assemblyMethod,
+ FailureMechanismAssemblyCategoryGroup.NotApplicable),
+ Enumerable.Empty(),
+ Enumerable.Empty(),
+ failureMechanismCode,
+ failureMechanismGroup);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs
===================================================================
diff -u -r85059e781f7f4982909f6acf6fca8bc6c618434c -r999594396502871b85138c2d1d49912ddb0e102a
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs (.../ExportableSectionAssemblyResultFactory.cs) (revision 85059e781f7f4982909f6acf6fca8bc6c618434c)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableSectionAssemblyResultFactory.cs (.../ExportableSectionAssemblyResultFactory.cs) (revision 999594396502871b85138c2d1d49912ddb0e102a)
@@ -13,12 +13,29 @@
/// Creates an instance of
/// based on the .
///
- ///
+ /// The assembly result of this section.
/// The assembly method
/// which was used to generate the result.
/// A .
/// Thrown when
/// is null.
+ public static ExportableSectionAssemblyResult CreateExportableSectionAssemblyResult(
+ FailureMechanismSectionAssemblyCategoryGroup failureMechanismSectionAssembly,
+ ExportableAssemblyMethod assemblyMethod)
+ {
+ return new ExportableSectionAssemblyResult(assemblyMethod, failureMechanismSectionAssembly);
+ }
+
+ ///
+ /// Creates an instance of
+ /// based on the .
+ ///
+ /// The assembly result of this section.
+ /// The assembly method
+ /// which was used to generate the result.
+ /// A .
+ /// Thrown when
+ /// is null.
public static ExportableSectionAssemblyResultWithProbability CreateExportableSectionAssemblyResultWithProbability(
FailureMechanismSectionAssembly failureMechanismSectionAssembly,
ExportableAssemblyMethod assemblyMethod)
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableFailureMechanismFactoryTest.cs
===================================================================
diff -u -r0fd76a0bde626efdb5058ada2df39285ca4333cf -r999594396502871b85138c2d1d49912ddb0e102a
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableFailureMechanismFactoryTest.cs (.../ExportableFailureMechanismFactoryTest.cs) (revision 0fd76a0bde626efdb5058ada2df39285ca4333cf)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableFailureMechanismFactoryTest.cs (.../ExportableFailureMechanismFactoryTest.cs) (revision 999594396502871b85138c2d1d49912ddb0e102a)
@@ -21,7 +21,7 @@
// Call
ExportableFailureMechanism exportableFailureMechanism =
- ExportableFailureMechanismFactory.CreateDefaultExportableFailureMechanismWithProbability(failureMechanismCode, @group, assemblyMethod);
+ ExportableFailureMechanismFactory.CreateDefaultExportableFailureMechanismWithProbability(failureMechanismCode, group, assemblyMethod);
// Assert
Assert.AreEqual(group, exportableFailureMechanism.Group);
@@ -35,5 +35,30 @@
CollectionAssert.IsEmpty(exportableFailureMechanism.Sections);
CollectionAssert.IsEmpty(exportableFailureMechanism.SectionAssemblyResults);
}
+
+ [Test]
+ public void CreateDefaultExportableFailureMechanismWithoutProbability_Always_ReturnsExportableFailureMechanism()
+ {
+ // Setup
+ var random = new Random(21);
+ var group = random.NextEnumValue();
+ var failureMechanismCode = random.NextEnumValue();
+ var assemblyMethod = random.NextEnumValue();
+
+ // Call
+ ExportableFailureMechanism exportableFailureMechanism =
+ ExportableFailureMechanismFactory.CreateDefaultExportableFailureMechanismWithoutProbability(failureMechanismCode, group, assemblyMethod);
+
+ // Assert
+ Assert.AreEqual(group, exportableFailureMechanism.Group);
+ Assert.AreEqual(failureMechanismCode, exportableFailureMechanism.Code);
+
+ ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResult = exportableFailureMechanism.FailureMechanismAssembly;
+ Assert.AreEqual(assemblyMethod, failureMechanismAssemblyResult.AssemblyMethod);
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, failureMechanismAssemblyResult.AssemblyCategory);
+
+ CollectionAssert.IsEmpty(exportableFailureMechanism.Sections);
+ CollectionAssert.IsEmpty(exportableFailureMechanism.SectionAssemblyResults);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs
===================================================================
diff -u -r85059e781f7f4982909f6acf6fca8bc6c618434c -r999594396502871b85138c2d1d49912ddb0e102a
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs (.../ExportableSectionAssemblyResultFactoryTest.cs) (revision 85059e781f7f4982909f6acf6fca8bc6c618434c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableSectionAssemblyResultFactoryTest.cs (.../ExportableSectionAssemblyResultFactoryTest.cs) (revision 999594396502871b85138c2d1d49912ddb0e102a)
@@ -11,6 +11,23 @@
public class ExportableSectionAssemblyResultFactoryTest
{
[Test]
+ public void CreateExportableSectionAssemblyResult_WithValidArguments_ReturnsExportableAssemblyResult()
+ {
+ // Setup
+ var random = new Random(21);
+ var assembly = random.NextEnumValue();
+ var assemblyMethod = random.NextEnumValue();
+
+ // Call
+ ExportableSectionAssemblyResult exportableAssemblyResult =
+ ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResult(assembly, assemblyMethod);
+
+ // Assert
+ Assert.AreEqual(assembly, exportableAssemblyResult.AssemblyCategory);
+ Assert.AreEqual(assemblyMethod, exportableAssemblyResult.AssemblyMethod);
+ }
+
+ [Test]
public void CreateExportableSectionAssemblyResultWithProbability_FailureMechanismSectionAssemblyNull_ThrowsArgumentNullException()
{
// Setiup
@@ -35,7 +52,7 @@
var assemblyMethod = random.NextEnumValue();
// Call
- ExportableSectionAssemblyResultWithProbability exportableAssemblyResult =
+ ExportableSectionAssemblyResultWithProbability exportableAssemblyResult =
ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResultWithProbability(assembly, assemblyMethod);
// Assert