Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismSectionAssemblyCreator.cs
===================================================================
diff -u -rdaba41934fd3e36f126b88abdd88bc4266e08d33 -r7517739c93562c9f902e00fb2c1dfcfb0cbb7f73
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismSectionAssemblyCreator.cs (.../AggregatedSerializableFailureMechanismSectionAssemblyCreator.cs) (revision daba41934fd3e36f126b88abdd88bc4266e08d33)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Creators/AggregatedSerializableFailureMechanismSectionAssemblyCreator.cs (.../AggregatedSerializableFailureMechanismSectionAssemblyCreator.cs) (revision 7517739c93562c9f902e00fb2c1dfcfb0cbb7f73)
@@ -75,12 +75,8 @@
throw new ArgumentNullException(nameof(sectionResult));
}
- if (!IsSectionAssemblyResultValid(sectionResult.CombinedAssembly))
- {
- throw new AssemblyExportException(@"The assembly result is invalid and cannot be exported.");
- }
+ ValidateAssemblyResult(sectionResult.CombinedAssembly);
-
SerializableFailureMechanismSection failureMechanismSection = SerializableFailureMechanismSectionCreator.Create(idGenerator,
serializableCollection,
sectionResult.FailureMechanismSection);
@@ -132,12 +128,8 @@
throw new ArgumentNullException(nameof(sectionResult));
}
- if (!IsSectionAssemblyResultValid(sectionResult.CombinedAssembly))
- {
- throw new AssemblyExportException(@"The assembly result is invalid and cannot be exported.");
- }
+ ValidateAssemblyResult(sectionResult.CombinedAssembly);
-
SerializableFailureMechanismSection failureMechanismSection = SerializableFailureMechanismSectionCreator.Create(idGenerator,
serializableCollection,
sectionResult.FailureMechanismSection);
@@ -189,10 +181,7 @@
throw new ArgumentNullException(nameof(sectionResult));
}
- if (!IsSectionAssemblyResultValid(sectionResult.CombinedAssembly))
- {
- throw new AssemblyExportException(@"The assembly result is invalid and cannot be exported.");
- }
+ ValidateAssemblyResult(sectionResult.CombinedAssembly);
SerializableFailureMechanismSection failureMechanismSection = SerializableFailureMechanismSectionCreator.Create(idGenerator,
serializableCollection,
@@ -208,9 +197,18 @@
failureMechanismSectionAssembly);
}
- private static bool IsSectionAssemblyResultValid(ExportableSectionAssemblyResult result)
+ ///
+ /// Validates if an .
+ ///
+ /// The to validate.
+ /// Thrown when
+ /// is invalid to export.
+ private static void ValidateAssemblyResult(ExportableSectionAssemblyResult result)
{
- return result.AssemblyCategory != FailureMechanismSectionAssemblyCategoryGroup.None;
+ if (result.AssemblyCategory == FailureMechanismSectionAssemblyCategoryGroup.None)
+ {
+ throw new AssemblyExportException(@"The assembly result is invalid and cannot be exported.");
+ }
}
private static SerializableFailureMechanismSectionAssemblyResult[] CreateAssemblySectionResults(ExportableAggregatedFailureMechanismSectionAssemblyResult sectionResult)