Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismCreator.cs =================================================================== diff -u -r4b7ea112093d1c9c952fd0b56fe78ba13b4e03e8 -rbaec4bec0cf9bc8516b945be1939c1bd4a10f53b --- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismCreator.cs (.../AggregatedSerializableFailureMechanismCreator.cs) (revision 4b7ea112093d1c9c952fd0b56fe78ba13b4e03e8) +++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismCreator.cs (.../AggregatedSerializableFailureMechanismCreator.cs) (revision baec4bec0cf9bc8516b945be1939c1bd4a10f53b) @@ -167,6 +167,18 @@ return AggregatedSerializableFailureMechanismSectionAssemblyCreator.Create(idGenerator, serializableCollection, serializableFailureMechanism, resultWithoutDetailedAssembly); } + var resultWithCombinedAssembly = failureMechanismSectionAssemblyResult as ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedResult; + if (resultWithCombinedAssembly != null) + { + return AggregatedSerializableFailureMechanismSectionAssemblyCreator.Create(idGenerator, serializableCollection, serializableFailureMechanism, resultWithCombinedAssembly); + } + + var resultWithCombinedProbabilityAssembly = failureMechanismSectionAssemblyResult as ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult; + if (resultWithCombinedProbabilityAssembly != null) + { + return AggregatedSerializableFailureMechanismSectionAssemblyCreator.Create(idGenerator, serializableCollection, serializableFailureMechanism, resultWithCombinedProbabilityAssembly); + } + throw new NotSupportedException($"{failureMechanismSectionAssemblyResult.GetType().Name} is not supported."); } } Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/AggregatedSerializableFailureMechanismCreatorTest.cs =================================================================== diff -u -r821ea9c9eada82e432462f9be0390dd5b45ffb29 -rbaec4bec0cf9bc8516b945be1939c1bd4a10f53b --- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/AggregatedSerializableFailureMechanismCreatorTest.cs (.../AggregatedSerializableFailureMechanismCreatorTest.cs) (revision 821ea9c9eada82e432462f9be0390dd5b45ffb29) +++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Creators/AggregatedSerializableFailureMechanismCreatorTest.cs (.../AggregatedSerializableFailureMechanismCreatorTest.cs) (revision baec4bec0cf9bc8516b945be1939c1bd4a10f53b) @@ -385,6 +385,28 @@ actualSectionAssemblyResult.CombinedSectionResult); } + private static void AssertSectionAssemblyWithCombinedResult(ExportableAggregatedFailureMechanismSectionAssemblyResultBase expectedSectionAssemblyResult, + SerializableFailureMechanismSectionAssembly actualSectionAssemblyResult) + { + var expectedSectionAssemblyResultWithoutProbability = (ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedResult) expectedSectionAssemblyResult; + CollectionAssert.IsEmpty(actualSectionAssemblyResult.SectionResults); + + SerializableFailureMechanismSectionAssemblyResultTestHelper.AssertAssemblyResult(expectedSectionAssemblyResultWithoutProbability.CombinedAssembly, + SerializableAssessmentType.CombinedAssessment, + actualSectionAssemblyResult.CombinedSectionResult); + } + + private static void AssertSectionAssemblyWithCombinedProbabilityResult(ExportableAggregatedFailureMechanismSectionAssemblyResultBase expectedSectionAssemblyResult, + SerializableFailureMechanismSectionAssembly actualSectionAssemblyResult) + { + var expectedSectionAssemblyResultWithoutProbability = (ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult) expectedSectionAssemblyResult; + CollectionAssert.IsEmpty(actualSectionAssemblyResult.SectionResults); + + SerializableFailureMechanismSectionAssemblyResultTestHelper.AssertAssemblyResult(expectedSectionAssemblyResultWithoutProbability.CombinedAssembly, + SerializableAssessmentType.CombinedAssessment, + actualSectionAssemblyResult.CombinedSectionResult); + } + private static SerializableTotalAssemblyResult CreateSerializableTotalAssembly(string totalAssemblyId) { return new SerializableTotalAssemblyResult(totalAssemblyId, @@ -434,6 +456,28 @@ new Action(AssertSectionAssemblyResultsWithoutDetailedAssembly)) .SetName("SectionAssemblyResults without detailed assessment"); + + ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedResult[] failureMechanismSectionResultsWithCombinedAssembly = + { + CreateSectionResultWithCombinedAssembly(failureMechanismSections[0]), + CreateSectionResultWithCombinedAssembly(failureMechanismSections[1]) + }; + yield return new TestCaseData(failureMechanismSections, + failureMechanismSectionResultsWithCombinedAssembly, + new Action(AssertSectionAssemblyWithCombinedResult)) + .SetName("SectionAssemblyResults with combined assessment"); + + ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult[] failureMechanismSectionResultsWithCombinedProbabilityAssembly = + { + CreateSectionResultWithCombinedProbabilityAssembly(failureMechanismSections[0]), + CreateSectionResultWithCombinedProbabilityAssembly(failureMechanismSections[1]) + }; + yield return new TestCaseData(failureMechanismSections, + failureMechanismSectionResultsWithCombinedProbabilityAssembly, + new Action(AssertSectionAssemblyWithCombinedProbabilityResult)) + .SetName("SectionAssemblyResults with combined probability assessment"); } private static ExportableFailureMechanismSection CreateSection(int seed) @@ -472,6 +516,16 @@ CreateSectionAssemblyResult(12)); } + private static ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedResult CreateSectionResultWithCombinedAssembly(ExportableFailureMechanismSection section) + { + return new ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedResult(section, CreateSectionAssemblyResult(10)); + } + + private static ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult CreateSectionResultWithCombinedProbabilityAssembly(ExportableFailureMechanismSection section) + { + return new ExportableAggregatedFailureMechanismSectionAssemblyWithCombinedProbabilityResult(section, CreateSectionAssemblyResultWithProbability(10)); + } + private static ExportableSectionAssemblyResult CreateSectionAssemblyResult(int seed) { var random = new Random(seed);