Index: Riskeer/Integration/src/Riskeer.Integration.IO/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResult.cs
===================================================================
diff -u -r73991051d9869bec831a714115eb8c635566fd4d -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/src/Riskeer.Integration.IO/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResult.cs (.../ExportableFailureMechanismCombinedSectionAssemblyResult.cs) (revision 73991051d9869bec831a714115eb8c635566fd4d)
+++ Riskeer/Integration/src/Riskeer.Integration.IO/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResult.cs (.../ExportableFailureMechanismCombinedSectionAssemblyResult.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -32,9 +32,11 @@
/// Creates a new instance of
///
/// The assembly result of the combined section.
+ /// The type of the failure mechanism.
/// The code of the failure mechanism.
/// Thrown when is null.
public ExportableFailureMechanismCombinedSectionAssemblyResult(ExportableFailureMechanismSubSectionAssemblyResult sectionAssemblyResult,
+ ExportableFailureMechanismType failureMechanismType,
string code)
{
if (sectionAssemblyResult == null)
@@ -43,6 +45,7 @@
}
SectionAssemblyResult = sectionAssemblyResult;
+ FailureMechanismType = failureMechanismType;
Code = code;
}
@@ -52,6 +55,11 @@
public ExportableFailureMechanismSubSectionAssemblyResult SectionAssemblyResult { get; }
///
+ /// Gets the failure mechanism type.
+ ///
+ public ExportableFailureMechanismType FailureMechanismType { get; }
+
+ ///
/// Gets the code of the failure mechanism.
///
public string Code { get; }
Index: Riskeer/Integration/src/Riskeer.Integration.IO/Factories/ExportableCombinedSectionAssemblyFactory.cs
===================================================================
diff -u -r2077c21eebd3514bbc3f49f2cf9039100760f966 -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/src/Riskeer.Integration.IO/Factories/ExportableCombinedSectionAssemblyFactory.cs (.../ExportableCombinedSectionAssemblyFactory.cs) (revision 2077c21eebd3514bbc3f49f2cf9039100760f966)
+++ Riskeer/Integration/src/Riskeer.Integration.IO/Factories/ExportableCombinedSectionAssemblyFactory.cs (.../ExportableCombinedSectionAssemblyFactory.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -119,7 +119,7 @@
{
return new ExportableFailureMechanismCombinedSectionAssemblyResult(
new ExportableFailureMechanismSubSectionAssemblyResult(sectionAssemblyGroup, ExportableAssemblyMethod.WBI3B1),
- failureMechanismCode);
+ ExportableFailureMechanismType.Generic, failureMechanismCode);
}
}
}
\ No newline at end of file
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResultTest.cs
===================================================================
diff -u -r73991051d9869bec831a714115eb8c635566fd4d -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResultTest.cs (.../ExportableFailureMechanismCombinedSectionAssemblyResultTest.cs) (revision 73991051d9869bec831a714115eb8c635566fd4d)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismCombinedSectionAssemblyResultTest.cs (.../ExportableFailureMechanismCombinedSectionAssemblyResultTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -33,8 +33,12 @@
[Test]
public void Constructor_SectionAssemblyResultNull_ThrowsArgumentNullException()
{
+ // Setup
+ var random = new Random(21);
+
// Call
- void Call() => new ExportableFailureMechanismCombinedSectionAssemblyResult(null, string.Empty);
+ void Call() => new ExportableFailureMechanismCombinedSectionAssemblyResult(
+ null, random.NextEnumValue(), string.Empty);
// Assert
var exception = Assert.Throws(Call);
@@ -49,12 +53,15 @@
var random = new Random(21);
var combinedSectionAssembly = new ExportableFailureMechanismSubSectionAssemblyResult(
random.NextEnumValue(), random.NextEnumValue());
+ var failureMechanismType = random.NextEnumValue();
// Call
- var assemblyResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(combinedSectionAssembly, code);
+ var assemblyResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(
+ combinedSectionAssembly, failureMechanismType, code);
// Assert
Assert.AreSame(combinedSectionAssembly, assemblyResult.SectionAssemblyResult);
+ Assert.AreEqual(failureMechanismType, assemblyResult.FailureMechanismType);
Assert.AreEqual(code, assemblyResult.Code);
}
}
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs
===================================================================
diff -u -r94da57aae6e9a2199d2bfbb04fa20675f34bff46 -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision 94da57aae6e9a2199d2bfbb04fa20675f34bff46)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Assembly/ExportableFailureMechanismTest.cs (.../ExportableFailureMechanismTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -84,7 +84,7 @@
// Assert
Assert.AreSame(failureMechanismAssembly, failureMechanism.FailureMechanismAssembly);
Assert.AreSame(sectionAssemblyResults, failureMechanism.SectionAssemblyResults);
- Assert.AreSame(failureMechanismType, failureMechanism.FailureMechanismType);
+ Assert.AreEqual(failureMechanismType, failureMechanism.FailureMechanismType);
Assert.AreEqual(code, failureMechanism.Code);
}
}
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/AggregatedSerializableCombinedFailureMechanismSectionAssembliesCreatorTest.cs
===================================================================
diff -u -r73991051d9869bec831a714115eb8c635566fd4d -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/AggregatedSerializableCombinedFailureMechanismSectionAssembliesCreatorTest.cs (.../AggregatedSerializableCombinedFailureMechanismSectionAssembliesCreatorTest.cs) (revision 73991051d9869bec831a714115eb8c635566fd4d)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/AggregatedSerializableCombinedFailureMechanismSectionAssembliesCreatorTest.cs (.../AggregatedSerializableCombinedFailureMechanismSectionAssembliesCreatorTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -171,8 +171,10 @@
private static ExportableFailureMechanismCombinedSectionAssemblyResult CreateCombinedSectionAssemblyResult(int seed)
{
var random = new Random(seed);
- return new ExportableFailureMechanismCombinedSectionAssemblyResult(CreateSectionAssemblyResult(random.Next()),
- "code");
+ return new ExportableFailureMechanismCombinedSectionAssemblyResult(
+ CreateSectionAssemblyResult(random.Next()),
+ random.NextEnumValue(),
+ "code");
}
private static ExportableFailureMechanismSubSectionAssemblyResult CreateSectionAssemblyResult(int seed)
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs
===================================================================
diff -u -r94da57aae6e9a2199d2bfbb04fa20675f34bff46 -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision 94da57aae6e9a2199d2bfbb04fa20675f34bff46)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableAssemblyCreatorTest.cs (.../SerializableAssemblyCreatorTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -139,15 +139,17 @@
ExportableFailureMechanismSectionAssemblyResultTestFactory.Create(section, 21),
new[]
{
- CreateCombinedSectionAssemblyResult(),
- CreateCombinedSectionAssemblyResult()
+ CreateCombinedSectionAssemblyResult(21),
+ CreateCombinedSectionAssemblyResult(22)
});
}
- private static ExportableFailureMechanismCombinedSectionAssemblyResult CreateCombinedSectionAssemblyResult()
+ private static ExportableFailureMechanismCombinedSectionAssemblyResult CreateCombinedSectionAssemblyResult(int seed)
{
+ var random = new Random(seed);
return new ExportableFailureMechanismCombinedSectionAssemblyResult(
ExportableFailureMechanismSubSectionAssemblyResultTestFactory.Create(),
+ random.NextEnumValue(),
"code");
}
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs
===================================================================
diff -u -r73991051d9869bec831a714115eb8c635566fd4d -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs) (revision 73991051d9869bec831a714115eb8c635566fd4d)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Creators/SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs (.../SerializableCombinedFailureMechanismSectionAssemblyResultCreatorTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -53,6 +53,7 @@
var random = new Random(21);
var sectionResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(
new ExportableFailureMechanismSubSectionAssemblyResult(assemblyGroup, random.NextEnumValue()),
+ random.NextEnumValue(),
"code");
// Call
@@ -67,14 +68,17 @@
public void Create_WithExportableFailureMechanismCombinedSectionAssemblyResult_ReturnsSerializableCombinedFailureMechanismSectionAssemblyResult()
{
// Setup
+ var random = new Random(21);
var sectionResult = new ExportableFailureMechanismCombinedSectionAssemblyResult(
- CreateSectionAssemblyResult(), "code");
+ CreateSectionAssemblyResult(), random.NextEnumValue(), "code");
// Call
SerializableCombinedFailureMechanismSectionAssemblyResult serializableResult =
SerializableCombinedFailureMechanismSectionAssemblyResultCreator.Create(sectionResult);
// Assert
+ Assert.AreEqual(SerializableFailureMechanismTypeCreator.Create(sectionResult.FailureMechanismType),
+ serializableResult.FailureMechanismType);
Assert.AreEqual(sectionResult.Code, serializableResult.GenericFailureMechanismCode);
ExportableFailureMechanismSubSectionAssemblyResult expectedSectionAssemblyResult = sectionResult.SectionAssemblyResult;
Assert.AreEqual(SerializableFailureMechanismSectionAssemblyGroupCreator.Create(expectedSectionAssemblyResult.AssemblyGroup),
Index: Riskeer/Integration/test/Riskeer.Integration.IO.Test/Factories/ExportableCombinedSectionAssemblyFactoryTest.cs
===================================================================
diff -u -r2077c21eebd3514bbc3f49f2cf9039100760f966 -r1cdc15bd01ac190087bbcda1989337b673800cb8
--- Riskeer/Integration/test/Riskeer.Integration.IO.Test/Factories/ExportableCombinedSectionAssemblyFactoryTest.cs (.../ExportableCombinedSectionAssemblyFactoryTest.cs) (revision 2077c21eebd3514bbc3f49f2cf9039100760f966)
+++ Riskeer/Integration/test/Riskeer.Integration.IO.Test/Factories/ExportableCombinedSectionAssemblyFactoryTest.cs (.../ExportableCombinedSectionAssemblyFactoryTest.cs) (revision 1cdc15bd01ac190087bbcda1989337b673800cb8)
@@ -74,7 +74,7 @@
new Point2D(0, 0),
new Point2D(2, 2)
});
-
+
CombinedFailureMechanismSectionAssemblyResult[] assemblyResults =
{
CreateCombinedFailureMechanismSectionAssemblyResult(21, hasAssemblyGroupResults),
@@ -180,50 +180,29 @@
Assert.AreEqual(15, failureMechanismCombinedSectionResults.Count());
Assert.IsTrue(failureMechanismCombinedSectionResults.All(result => result.SectionAssemblyResult.AssemblyMethod == ExportableAssemblyMethod.WBI3B1));
- Assert.AreEqual(expectedSection.Piping, failureMechanismCombinedSectionResults.ElementAt(0).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("STPH", failureMechanismCombinedSectionResults.ElementAt(0).Code);
+ AssertSubSection(expectedSection.Piping, "STPH", failureMechanismCombinedSectionResults.ElementAt(0));
+ AssertSubSection(expectedSection.GrassCoverErosionInwards, "GEKB", failureMechanismCombinedSectionResults.ElementAt(1));
+ AssertSubSection(expectedSection.MacroStabilityInwards, "STBI", failureMechanismCombinedSectionResults.ElementAt(2));
+ AssertSubSection(expectedSection.Microstability, "STMI", failureMechanismCombinedSectionResults.ElementAt(3));
+ AssertSubSection(expectedSection.StabilityStoneCover, "ZST", failureMechanismCombinedSectionResults.ElementAt(4));
+ AssertSubSection(expectedSection.WaveImpactAsphaltCover, "AGK", failureMechanismCombinedSectionResults.ElementAt(5));
+ AssertSubSection(expectedSection.WaterPressureAsphaltCover, "AWO", failureMechanismCombinedSectionResults.ElementAt(6));
+ AssertSubSection(expectedSection.GrassCoverErosionOutwards, "GEBU", failureMechanismCombinedSectionResults.ElementAt(7));
+ AssertSubSection(expectedSection.GrassCoverSlipOffOutwards, "GABU", failureMechanismCombinedSectionResults.ElementAt(8));
+ AssertSubSection(expectedSection.GrassCoverSlipOffInwards, "GABI", failureMechanismCombinedSectionResults.ElementAt(9));
+ AssertSubSection(expectedSection.HeightStructures, "HTKW", failureMechanismCombinedSectionResults.ElementAt(10));
+ AssertSubSection(expectedSection.ClosingStructures, "BSKW", failureMechanismCombinedSectionResults.ElementAt(11));
+ AssertSubSection(expectedSection.PipingStructure, "PKW", failureMechanismCombinedSectionResults.ElementAt(12));
+ AssertSubSection(expectedSection.StabilityPointStructures, "STKWp", failureMechanismCombinedSectionResults.ElementAt(13));
+ AssertSubSection(expectedSection.DuneErosion, "DA", failureMechanismCombinedSectionResults.ElementAt(14));
+ }
- Assert.AreEqual(expectedSection.GrassCoverErosionInwards, failureMechanismCombinedSectionResults.ElementAt(1).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("GEKB", failureMechanismCombinedSectionResults.ElementAt(1).Code);
-
- Assert.AreEqual(expectedSection.MacroStabilityInwards, failureMechanismCombinedSectionResults.ElementAt(2).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("STBI", failureMechanismCombinedSectionResults.ElementAt(2).Code);
-
- Assert.AreEqual(expectedSection.Microstability, failureMechanismCombinedSectionResults.ElementAt(3).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("STMI", failureMechanismCombinedSectionResults.ElementAt(3).Code);
-
- Assert.AreEqual(expectedSection.StabilityStoneCover, failureMechanismCombinedSectionResults.ElementAt(4).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("ZST", failureMechanismCombinedSectionResults.ElementAt(4).Code);
-
- Assert.AreEqual(expectedSection.WaveImpactAsphaltCover, failureMechanismCombinedSectionResults.ElementAt(5).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("AGK", failureMechanismCombinedSectionResults.ElementAt(5).Code);
-
- Assert.AreEqual(expectedSection.WaterPressureAsphaltCover, failureMechanismCombinedSectionResults.ElementAt(6).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("AWO", failureMechanismCombinedSectionResults.ElementAt(6).Code);
-
- Assert.AreEqual(expectedSection.GrassCoverErosionOutwards, failureMechanismCombinedSectionResults.ElementAt(7).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("GEBU", failureMechanismCombinedSectionResults.ElementAt(7).Code);
-
- Assert.AreEqual(expectedSection.GrassCoverSlipOffOutwards, failureMechanismCombinedSectionResults.ElementAt(8).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("GABU", failureMechanismCombinedSectionResults.ElementAt(8).Code);
-
- Assert.AreEqual(expectedSection.GrassCoverSlipOffInwards, failureMechanismCombinedSectionResults.ElementAt(9).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("GABI", failureMechanismCombinedSectionResults.ElementAt(9).Code);
-
- Assert.AreEqual(expectedSection.HeightStructures, failureMechanismCombinedSectionResults.ElementAt(10).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("HTKW", failureMechanismCombinedSectionResults.ElementAt(10).Code);
-
- Assert.AreEqual(expectedSection.ClosingStructures, failureMechanismCombinedSectionResults.ElementAt(11).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("BSKW", failureMechanismCombinedSectionResults.ElementAt(11).Code);
-
- Assert.AreEqual(expectedSection.PipingStructure, failureMechanismCombinedSectionResults.ElementAt(12).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("PKW", failureMechanismCombinedSectionResults.ElementAt(12).Code);
-
- Assert.AreEqual(expectedSection.StabilityPointStructures, failureMechanismCombinedSectionResults.ElementAt(13).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("STKWp", failureMechanismCombinedSectionResults.ElementAt(13).Code);
-
- Assert.AreEqual(expectedSection.DuneErosion, failureMechanismCombinedSectionResults.ElementAt(14).SectionAssemblyResult.AssemblyGroup);
- Assert.AreEqual("DA", failureMechanismCombinedSectionResults.ElementAt(14).Code);
+ private static void AssertSubSection(FailureMechanismSectionAssemblyGroup? subSectionGroup, string subSectionCode,
+ ExportableFailureMechanismCombinedSectionAssemblyResult actualResult)
+ {
+ Assert.AreEqual(subSectionGroup, actualResult.SectionAssemblyResult.AssemblyGroup);
+ Assert.AreEqual(subSectionCode, actualResult.Code);
+ Assert.AreEqual(ExportableFailureMechanismType.Generic, actualResult.FailureMechanismType);
}
}
}
\ No newline at end of file