Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableFailureMechanism.cs =================================================================== diff -u -r95cc9e09a2390a216a0e933dc07841bcc67d5751 -r7448b440911e68c1ec42907fda23a45a1a71fcef --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableFailureMechanism.cs (.../ExportableFailureMechanism.cs) (revision 95cc9e09a2390a216a0e933dc07841bcc67d5751) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Assembly/ExportableFailureMechanism.cs (.../ExportableFailureMechanism.cs) (revision 7448b440911e68c1ec42907fda23a45a1a71fcef) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Ringtoets.Integration.IO.Assembly { @@ -33,8 +34,21 @@ { /// /// Creates a new instance of + /// without section assembly results. /// /// The assembly result of the failure mechanism. + /// The code of the failure mechanism. + /// The group of the failure mechanism. + /// Thrown when is null. + public ExportableFailureMechanism(TFailureMechanismAssemblyResult failureMechanismAssembly, + ExportableFailureMechanismType code, + ExportableFailureMechanismGroup group) + : this(failureMechanismAssembly, Enumerable.Empty(), code, group) {} + + /// + /// Creates a new instance of . + /// + /// The assembly result of the failure mechanism. /// The assembly results for the failure mechanism sections. /// The code of the failure mechanism. /// The group of the failure mechanism. @@ -50,7 +64,6 @@ throw new ArgumentNullException(nameof(failureMechanismAssembly)); } - if (sectionAssemblyResults == null) { throw new ArgumentNullException(nameof(sectionAssemblyResults)); Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs =================================================================== diff -u -r95cc9e09a2390a216a0e933dc07841bcc67d5751 -r7448b440911e68c1ec42907fda23a45a1a71fcef --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs (.../ExportableFailureMechanismFactory.cs) (revision 95cc9e09a2390a216a0e933dc07841bcc67d5751) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableFailureMechanismFactory.cs (.../ExportableFailureMechanismFactory.cs) (revision 7448b440911e68c1ec42907fda23a45a1a71fcef) @@ -47,7 +47,6 @@ new ExportableFailureMechanismAssemblyResultWithProbability(assemblyMethod, FailureMechanismAssemblyCategoryGroup.NotApplicable, 0), - Enumerable.Empty(), failureMechanismCode, failureMechanismGroup); } @@ -68,7 +67,6 @@ return new ExportableFailureMechanism( new ExportableFailureMechanismAssemblyResult(assemblyMethod, FailureMechanismAssemblyCategoryGroup.NotApplicable), - Enumerable.Empty(), failureMechanismCode, failureMechanismGroup); } Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs =================================================================== diff -u -r95cc9e09a2390a216a0e933dc07841bcc67d5751 -r7448b440911e68c1ec42907fda23a45a1a71fcef --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision 95cc9e09a2390a216a0e933dc07841bcc67d5751) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision 7448b440911e68c1ec42907fda23a45a1a71fcef) @@ -37,6 +37,44 @@ { // Setup var random = new Random(21); + + // Call + TestDelegate call = () => new ExportableFailureMechanism(null, + random.NextEnumValue(), + random.NextEnumValue()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanismAssembly", exception.ParamName); + } + + [Test] + public void Constructor_WithValidArguments_ExpectedValues() + { + // Setup + var random = new Random(21); + ExportableFailureMechanismAssemblyResult failureMechanismAssembly = + ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(); + var code = random.NextEnumValue(); + var group = random.NextEnumValue(); + + // Call + var failureMechanism = new ExportableFailureMechanism(failureMechanismAssembly, + code, + group); + + // Assert + Assert.AreSame(failureMechanismAssembly, failureMechanism.FailureMechanismAssembly); + CollectionAssert.IsEmpty(failureMechanism.SectionAssemblyResults); + Assert.AreEqual(code, failureMechanism.Code); + Assert.AreEqual(group, failureMechanism.Group); + } + + [Test] + public void ConstructorWithSectionAssemblyResults_FailureMechanismAssemblyResultNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); IEnumerable sectionAssemblyResults = Enumerable.Empty(); var code = random.NextEnumValue(); @@ -52,7 +90,7 @@ } [Test] - public void Constructor_SectionAssemblyResultsNull_ThrowsArgumentNullException() + public void ConstructorWithSectionAssemblyResults_SectionAssemblyResultsNull_ThrowsArgumentNullException() { // Setup var random = new Random(21); @@ -61,15 +99,15 @@ // Call TestDelegate call = () => new ExportableFailureMechanism( - ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(), null, code, @group); + ExportableFailureMechanismAssemblyResultTestFactory.CreateResultWithoutProbability(), null, code, group); // Assert var exception = Assert.Throws(call); Assert.AreEqual("sectionAssemblyResults", exception.ParamName); } [Test] - public void Constructor_WithValidArguments_ExpectedValues() + public void ConstructorWithSectionAssemblyResults_WithValidArguments_ExpectedValues() { // Setup var random = new Random(21);