Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs =================================================================== diff -u -r7800f33732672169d412d1edba6efdc36e20e281 -r1740672dc31412e7e94c4742f2bdbc91ee3f74cf --- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs (.../AssessmentSectionAssemblyTestHelperTest.cs) (revision 7800f33732672169d412d1edba6efdc36e20e281) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs (.../AssessmentSectionAssemblyTestHelperTest.cs) (revision 1740672dc31412e7e94c4742f2bdbc91ee3f74cf) @@ -62,57 +62,95 @@ PipingFailureMechanism piping = assessmentSection.Piping; Assert.AreSame(piping, pipingTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, piping); - PipingFailureMechanismSectionResult pipingSectionResult = piping.SectionResults.Single(); - Assert.IsTrue(pipingSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, pipingSectionResult.ManualAssemblyProbability); + AssertPipingFailureMechanism(expectedManualProbability, piping); TestCaseData macroStabilityInwardsTestCase = testCases[1]; assessmentSection = (AssessmentSection) macroStabilityInwardsTestCase.Arguments[0]; MacroStabilityInwardsFailureMechanism macroStabilityInwards = assessmentSection.MacroStabilityInwards; Assert.AreSame(macroStabilityInwards, macroStabilityInwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, macroStabilityInwards); - MacroStabilityInwardsFailureMechanismSectionResult macroStabilityInwardsSectionResult = macroStabilityInwards.SectionResults.Single(); - Assert.IsTrue(macroStabilityInwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, macroStabilityInwardsSectionResult.ManualAssemblyProbability); + AssertMacroStabilityInwardsFailureMechanism(expectedManualProbability, macroStabilityInwards); TestCaseData grassCoverErosionInwardsTestCase = testCases[2]; assessmentSection = (AssessmentSection) grassCoverErosionInwardsTestCase.Arguments[0]; GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwards = assessmentSection.GrassCoverErosionInwards; Assert.AreSame(grassCoverErosionInwards, grassCoverErosionInwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, grassCoverErosionInwards); - GrassCoverErosionInwardsFailureMechanismSectionResult grassCoverErosionInwardsSectionResult = grassCoverErosionInwards.SectionResults.Single(); - Assert.IsTrue(grassCoverErosionInwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, grassCoverErosionInwardsSectionResult.ManualAssemblyProbability); + AssertGrassCoverErosionInwardsFailureMechanism(expectedManualProbability, grassCoverErosionInwards); TestCaseData closingStructuresTestCase = testCases[3]; assessmentSection = (AssessmentSection) closingStructuresTestCase.Arguments[0]; ClosingStructuresFailureMechanism closingStructures = assessmentSection.ClosingStructures; Assert.AreSame(closingStructures, closingStructuresTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, closingStructures); - ClosingStructuresFailureMechanismSectionResult closingStructuresSectionResult = closingStructures.SectionResults.Single(); - Assert.IsTrue(closingStructuresSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, closingStructuresSectionResult.ManualAssemblyProbability); + AssertClosingStructuresFailureMechanism(expectedManualProbability, closingStructures); TestCaseData heightStructuresTestCase = testCases[4]; assessmentSection = (AssessmentSection) heightStructuresTestCase.Arguments[0]; HeightStructuresFailureMechanism heightStructures = assessmentSection.HeightStructures; Assert.AreSame(heightStructures, heightStructuresTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, heightStructures); - HeightStructuresFailureMechanismSectionResult heightStructuresSectionResult = heightStructures.SectionResults.Single(); - Assert.IsTrue(heightStructuresSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, heightStructuresSectionResult.ManualAssemblyProbability); + AssertHeightStructuresFailureMechanism(expectedManualProbability, heightStructures); TestCaseData stabilityPointStructuresTestCase = testCases[5]; assessmentSection = (AssessmentSection) stabilityPointStructuresTestCase.Arguments[0]; StabilityPointStructuresFailureMechanism stabilityPointStructures = assessmentSection.StabilityPointStructures; Assert.AreSame(stabilityPointStructures, stabilityPointStructuresTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, stabilityPointStructures); - StabilityPointStructuresFailureMechanismSectionResult stabilityPointStructuresSectionResult = stabilityPointStructures.SectionResults.Single(); - Assert.IsTrue(stabilityPointStructuresSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualProbability, stabilityPointStructuresSectionResult.ManualAssemblyProbability); + AssertStabilityPointStructuresFailureMechanism(expectedManualProbability, stabilityPointStructures); } [Test] + public void GetAssessmentSectionWithoutConfiguredFailureMechanismWithProbability_Always_ReturnsExpectedTestCases() + { + // Call + TestCaseData[] testCases = AssessmentSectionAssemblyTestHelper.GetAssessmentSectionWithoutConfiguredFailureMechanismWithProbability() + .ToArray(); + + // Assert + Assert.AreEqual(6, testCases.Length); + Assert.IsTrue(testCases.All(tc => tc.Arguments.Length == 1)); + + const double expectedManualProbability = 0.5; + + TestCaseData pipingTestCase = testCases[0]; + var assessmentSection = (AssessmentSection) pipingTestCase.Arguments[0]; + PipingFailureMechanism piping = assessmentSection.Piping; + AssertAssessmentSection(assessmentSection, piping); + AssertPipingFailureMechanism(expectedManualProbability, piping); + + TestCaseData macroStabilityInwardsTestCase = testCases[1]; + assessmentSection = (AssessmentSection) macroStabilityInwardsTestCase.Arguments[0]; + MacroStabilityInwardsFailureMechanism macroStabilityInwards = assessmentSection.MacroStabilityInwards; + AssertAssessmentSection(assessmentSection, macroStabilityInwards); + AssertMacroStabilityInwardsFailureMechanism(expectedManualProbability, macroStabilityInwards); + + TestCaseData grassCoverErosionInwardsTestCase = testCases[2]; + assessmentSection = (AssessmentSection) grassCoverErosionInwardsTestCase.Arguments[0]; + GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwards = assessmentSection.GrassCoverErosionInwards; + AssertAssessmentSection(assessmentSection, grassCoverErosionInwards); + AssertGrassCoverErosionInwardsFailureMechanism(expectedManualProbability, grassCoverErosionInwards); + + TestCaseData closingStructuresTestCase = testCases[3]; + assessmentSection = (AssessmentSection) closingStructuresTestCase.Arguments[0]; + ClosingStructuresFailureMechanism closingStructures = assessmentSection.ClosingStructures; + AssertAssessmentSection(assessmentSection, closingStructures); + AssertClosingStructuresFailureMechanism(expectedManualProbability, closingStructures); + + TestCaseData heightStructuresTestCase = testCases[4]; + assessmentSection = (AssessmentSection) heightStructuresTestCase.Arguments[0]; + HeightStructuresFailureMechanism heightStructures = assessmentSection.HeightStructures; + AssertAssessmentSection(assessmentSection, heightStructures); + AssertHeightStructuresFailureMechanism(expectedManualProbability, heightStructures); + + TestCaseData stabilityPointStructuresTestCase = testCases[5]; + assessmentSection = (AssessmentSection) stabilityPointStructuresTestCase.Arguments[0]; + StabilityPointStructuresFailureMechanism stabilityPointStructures = assessmentSection.StabilityPointStructures; + AssertAssessmentSection(assessmentSection, stabilityPointStructures); + AssertStabilityPointStructuresFailureMechanism(expectedManualProbability, stabilityPointStructures); + } + + [Test] public void GetAssessmentSectionWithConfiguredFailureMechanismsWithoutProbability_Always_ReturnsExpectedTestCases() { // Call @@ -131,111 +169,173 @@ DuneErosionFailureMechanism duneErosion = assessmentSection.DuneErosion; Assert.AreSame(duneErosion, duneErosionTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, duneErosion); - DuneErosionFailureMechanismSectionResult duneErosionSectionResult = duneErosion.SectionResults.Single(); - Assert.IsTrue(duneErosionSectionResult.UseManualAssembly); - Assert.AreEqual(expectedSectionAssemblyGroup, duneErosionSectionResult.ManualAssemblyCategoryGroup); + AssertDuneErosionFailureMechanism(expectedSectionAssemblyGroup, duneErosion); TestCaseData grassCoverErosionOutwardsTestCase = testCases[1]; assessmentSection = (AssessmentSection) grassCoverErosionOutwardsTestCase.Arguments[0]; GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards = assessmentSection.GrassCoverErosionOutwards; Assert.AreSame(grassCoverErosionOutwards, grassCoverErosionOutwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, grassCoverErosionOutwards); - GrassCoverErosionOutwardsFailureMechanismSectionResult grassCoverErosionOutwardsSectionResult = grassCoverErosionOutwards.SectionResults.Single(); - Assert.IsTrue(grassCoverErosionOutwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedSectionAssemblyGroup, grassCoverErosionOutwardsSectionResult.ManualAssemblyCategoryGroup); + AssertGrassCoverErosionOutwardsFailureMechanism(expectedSectionAssemblyGroup, grassCoverErosionOutwards); TestCaseData stabilityStoneCoverTestCase = testCases[2]; assessmentSection = (AssessmentSection) stabilityStoneCoverTestCase.Arguments[0]; StabilityStoneCoverFailureMechanism stabilityStoneCover = assessmentSection.StabilityStoneCover; Assert.AreSame(stabilityStoneCover, stabilityStoneCoverTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, stabilityStoneCover); - StabilityStoneCoverFailureMechanismSectionResult stabilityStoneCoverSectionResult = stabilityStoneCover.SectionResults.Single(); - Assert.IsTrue(stabilityStoneCoverSectionResult.UseManualAssembly); - Assert.AreEqual(expectedSectionAssemblyGroup, stabilityStoneCoverSectionResult.ManualAssemblyCategoryGroup); + AssertStabilityStoneCoverFailureMechanism(expectedSectionAssemblyGroup, stabilityStoneCover); TestCaseData waveImpactAsphaltCoverTestCase = testCases[3]; assessmentSection = (AssessmentSection) waveImpactAsphaltCoverTestCase.Arguments[0]; WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover = assessmentSection.WaveImpactAsphaltCover; Assert.AreSame(waveImpactAsphaltCover, waveImpactAsphaltCoverTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, waveImpactAsphaltCover); - WaveImpactAsphaltCoverFailureMechanismSectionResult waveImpactAsphaltCoverSectionResult = waveImpactAsphaltCover.SectionResults.Single(); - Assert.IsTrue(waveImpactAsphaltCoverSectionResult.UseManualAssembly); - Assert.AreEqual(expectedSectionAssemblyGroup, waveImpactAsphaltCoverSectionResult.ManualAssemblyCategoryGroup); + AssertWaveImpactAsphaltCoverFailureMechanism(expectedSectionAssemblyGroup, waveImpactAsphaltCover); TestCaseData grassCoverSlipOffInwardsTestCase = testCases[4]; assessmentSection = (AssessmentSection) grassCoverSlipOffInwardsTestCase.Arguments[0]; GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwards = assessmentSection.GrassCoverSlipOffInwards; Assert.AreSame(grassCoverSlipOffInwards, grassCoverSlipOffInwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, grassCoverSlipOffInwards); - GrassCoverSlipOffInwardsFailureMechanismSectionResult grassCoverSlipOffInwardsSectionResult = grassCoverSlipOffInwards.SectionResults.Single(); - Assert.IsTrue(grassCoverSlipOffInwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, grassCoverSlipOffInwardsSectionResult.ManualAssemblyCategoryGroup); + AssertGrassCoverSlipOffInwardsFailureMechanism(expectedManualSectionAssemblyGroup, grassCoverSlipOffInwards); TestCaseData grassCoverSlipOffOutwardsTestCase = testCases[5]; assessmentSection = (AssessmentSection) grassCoverSlipOffOutwardsTestCase.Arguments[0]; GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwards = assessmentSection.GrassCoverSlipOffOutwards; Assert.AreSame(grassCoverSlipOffOutwards, grassCoverSlipOffOutwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, grassCoverSlipOffOutwards); - GrassCoverSlipOffOutwardsFailureMechanismSectionResult grassCoverSlipOffOutwardsSectionResult = grassCoverSlipOffOutwards.SectionResults.Single(); - Assert.IsTrue(grassCoverSlipOffOutwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, grassCoverSlipOffOutwardsSectionResult.ManualAssemblyCategoryGroup); + AssertGrassCoverSlipOffOutwardsFailureMechanism(expectedManualSectionAssemblyGroup, grassCoverSlipOffOutwards); TestCaseData pipingStructureTestCase = testCases[6]; assessmentSection = (AssessmentSection) pipingStructureTestCase.Arguments[0]; PipingStructureFailureMechanism pipingStructure = assessmentSection.PipingStructure; Assert.AreSame(pipingStructure, pipingStructureTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, pipingStructure); - PipingStructureFailureMechanismSectionResult pipingStructureSectionResult = pipingStructure.SectionResults.Single(); - Assert.IsTrue(pipingStructureSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, pipingStructureSectionResult.ManualAssemblyCategoryGroup); + AssertPipingStructureFailureMechanism(expectedManualSectionAssemblyGroup, pipingStructure); TestCaseData strengthStabilityLengthWiseConstructionTestCase = testCases[7]; assessmentSection = (AssessmentSection) strengthStabilityLengthWiseConstructionTestCase.Arguments[0]; StrengthStabilityLengthwiseConstructionFailureMechanism strengthStabilityLengthwiseConstruction = assessmentSection.StrengthStabilityLengthwiseConstruction; Assert.AreSame(strengthStabilityLengthwiseConstruction, strengthStabilityLengthWiseConstructionTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, strengthStabilityLengthwiseConstruction); - StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult strengthStabilityLengthwiseConstructionSectionResult = - strengthStabilityLengthwiseConstruction.SectionResults.Single(); - Assert.IsTrue(strengthStabilityLengthwiseConstructionSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, strengthStabilityLengthwiseConstructionSectionResult.ManualAssemblyCategoryGroup); + AssertStrengthStabilityLengthWiseConstructionFailureMechanism(expectedManualSectionAssemblyGroup, strengthStabilityLengthwiseConstruction); TestCaseData technicalInnovationTestCase = testCases[8]; assessmentSection = (AssessmentSection) technicalInnovationTestCase.Arguments[0]; TechnicalInnovationFailureMechanism technicalInnovation = assessmentSection.TechnicalInnovation; Assert.AreSame(technicalInnovation, technicalInnovationTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, technicalInnovation); - TechnicalInnovationFailureMechanismSectionResult technicalInnovationSectionResult = technicalInnovation.SectionResults.Single(); - Assert.IsTrue(technicalInnovationSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, technicalInnovationSectionResult.ManualAssemblyCategoryGroup); + AssertTechnicalInnovationFailureMechanism(expectedManualSectionAssemblyGroup, technicalInnovation); TestCaseData microstabilityTestCase = testCases[9]; assessmentSection = (AssessmentSection) microstabilityTestCase.Arguments[0]; MicrostabilityFailureMechanism microstability = assessmentSection.Microstability; Assert.AreSame(microstability, microstabilityTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, microstability); - MicrostabilityFailureMechanismSectionResult microstabilitySectionResult = microstability.SectionResults.Single(); - Assert.IsTrue(microstabilitySectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, microstabilitySectionResult.ManualAssemblyCategoryGroup); + AssertMicrostabilityFailureMechanism(expectedManualSectionAssemblyGroup, microstability); TestCaseData macroStabilityOutwardsTestCase = testCases[10]; assessmentSection = (AssessmentSection) macroStabilityOutwardsTestCase.Arguments[0]; MacroStabilityOutwardsFailureMechanism macroStabilityOutwards = assessmentSection.MacroStabilityOutwards; Assert.AreSame(macroStabilityOutwards, macroStabilityOutwardsTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, macroStabilityOutwards); - MacroStabilityOutwardsFailureMechanismSectionResult macroStabilityOutwardsSectionResult = macroStabilityOutwards.SectionResults.Single(); - Assert.IsTrue(macroStabilityOutwardsSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, macroStabilityOutwardsSectionResult.ManualAssemblyCategoryGroup); + AssertMacroStabilityOutwardsFailureMechanism(expectedManualSectionAssemblyGroup, macroStabilityOutwards); TestCaseData waterPressureAsphaltCoverTestCase = testCases[11]; assessmentSection = (AssessmentSection) waterPressureAsphaltCoverTestCase.Arguments[0]; WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCover = assessmentSection.WaterPressureAsphaltCover; Assert.AreSame(waterPressureAsphaltCover, waterPressureAsphaltCoverTestCase.Arguments[1]); AssertAssessmentSection(assessmentSection, waterPressureAsphaltCover); - WaterPressureAsphaltCoverFailureMechanismSectionResult waterPressureAsphaltCoverSectionResult = waterPressureAsphaltCover.SectionResults.Single(); - Assert.IsTrue(waterPressureAsphaltCoverSectionResult.UseManualAssembly); - Assert.AreEqual(expectedManualSectionAssemblyGroup, waterPressureAsphaltCoverSectionResult.ManualAssemblyCategoryGroup); + AssertWaterPressureAsphaltCoverFailureMechanism(expectedManualSectionAssemblyGroup, waterPressureAsphaltCover); } + [Test] + public void GetAssessmentSectionWithoutConfiguredFailureMechanismWithoutProbability_Always_ReturnsExpectedTestCases() + { + // Call + TestCaseData[] testCases = AssessmentSectionAssemblyTestHelper.GetAssessmentSectionWithoutConfiguredFailureMechanismWithoutProbability() + .ToArray(); + + // Assert + Assert.AreEqual(12, testCases.Length); + Assert.IsTrue(testCases.All(tc => tc.Arguments.Length == 1)); + + const FailureMechanismSectionAssemblyCategoryGroup expectedSectionAssemblyGroup = FailureMechanismSectionAssemblyCategoryGroup.Vv; + const ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup = ManualFailureMechanismSectionAssemblyCategoryGroup.Vv; + + TestCaseData duneErosionTestCase = testCases[0]; + var assessmentSection = (AssessmentSection) duneErosionTestCase.Arguments[0]; + DuneErosionFailureMechanism duneErosion = assessmentSection.DuneErosion; + AssertAssessmentSection(assessmentSection, duneErosion); + AssertDuneErosionFailureMechanism(expectedSectionAssemblyGroup, duneErosion); + + TestCaseData grassCoverErosionOutwardsTestCase = testCases[1]; + assessmentSection = (AssessmentSection) grassCoverErosionOutwardsTestCase.Arguments[0]; + GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards = assessmentSection.GrassCoverErosionOutwards; + AssertAssessmentSection(assessmentSection, grassCoverErosionOutwards); + AssertGrassCoverErosionOutwardsFailureMechanism(expectedSectionAssemblyGroup, grassCoverErosionOutwards); + + TestCaseData stabilityStoneCoverTestCase = testCases[2]; + assessmentSection = (AssessmentSection) stabilityStoneCoverTestCase.Arguments[0]; + StabilityStoneCoverFailureMechanism stabilityStoneCover = assessmentSection.StabilityStoneCover; + AssertAssessmentSection(assessmentSection, stabilityStoneCover); + AssertStabilityStoneCoverFailureMechanism(expectedSectionAssemblyGroup, stabilityStoneCover); + + TestCaseData waveImpactAsphaltCoverTestCase = testCases[3]; + assessmentSection = (AssessmentSection) waveImpactAsphaltCoverTestCase.Arguments[0]; + WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover = assessmentSection.WaveImpactAsphaltCover; + AssertAssessmentSection(assessmentSection, waveImpactAsphaltCover); + AssertWaveImpactAsphaltCoverFailureMechanism(expectedSectionAssemblyGroup, waveImpactAsphaltCover); + + TestCaseData grassCoverSlipOffInwardsTestCase = testCases[4]; + assessmentSection = (AssessmentSection) grassCoverSlipOffInwardsTestCase.Arguments[0]; + GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwards = assessmentSection.GrassCoverSlipOffInwards; + AssertAssessmentSection(assessmentSection, grassCoverSlipOffInwards); + AssertGrassCoverSlipOffInwardsFailureMechanism(expectedManualSectionAssemblyGroup, grassCoverSlipOffInwards); + + TestCaseData grassCoverSlipOffOutwardsTestCase = testCases[5]; + assessmentSection = (AssessmentSection) grassCoverSlipOffOutwardsTestCase.Arguments[0]; + GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwards = assessmentSection.GrassCoverSlipOffOutwards; + AssertAssessmentSection(assessmentSection, grassCoverSlipOffOutwards); + AssertGrassCoverSlipOffOutwardsFailureMechanism(expectedManualSectionAssemblyGroup, grassCoverSlipOffOutwards); + + TestCaseData pipingStructureTestCase = testCases[6]; + assessmentSection = (AssessmentSection) pipingStructureTestCase.Arguments[0]; + PipingStructureFailureMechanism pipingStructure = assessmentSection.PipingStructure; + AssertAssessmentSection(assessmentSection, pipingStructure); + AssertPipingStructureFailureMechanism(expectedManualSectionAssemblyGroup, pipingStructure); + + TestCaseData strengthStabilityLengthWiseConstructionTestCase = testCases[7]; + assessmentSection = (AssessmentSection) strengthStabilityLengthWiseConstructionTestCase.Arguments[0]; + StrengthStabilityLengthwiseConstructionFailureMechanism strengthStabilityLengthwiseConstruction = assessmentSection.StrengthStabilityLengthwiseConstruction; + AssertAssessmentSection(assessmentSection, strengthStabilityLengthwiseConstruction); + AssertStrengthStabilityLengthWiseConstructionFailureMechanism(expectedManualSectionAssemblyGroup, strengthStabilityLengthwiseConstruction); + + TestCaseData technicalInnovationTestCase = testCases[8]; + assessmentSection = (AssessmentSection) technicalInnovationTestCase.Arguments[0]; + TechnicalInnovationFailureMechanism technicalInnovation = assessmentSection.TechnicalInnovation; + AssertAssessmentSection(assessmentSection, technicalInnovation); + AssertTechnicalInnovationFailureMechanism(expectedManualSectionAssemblyGroup, technicalInnovation); + + TestCaseData microstabilityTestCase = testCases[9]; + assessmentSection = (AssessmentSection) microstabilityTestCase.Arguments[0]; + MicrostabilityFailureMechanism microstability = assessmentSection.Microstability; + AssertAssessmentSection(assessmentSection, microstability); + AssertMicrostabilityFailureMechanism(expectedManualSectionAssemblyGroup, microstability); + + TestCaseData macroStabilityOutwardsTestCase = testCases[10]; + assessmentSection = (AssessmentSection) macroStabilityOutwardsTestCase.Arguments[0]; + MacroStabilityOutwardsFailureMechanism macroStabilityOutwards = assessmentSection.MacroStabilityOutwards; + AssertAssessmentSection(assessmentSection, macroStabilityOutwards); + AssertMacroStabilityOutwardsFailureMechanism(expectedManualSectionAssemblyGroup, macroStabilityOutwards); + + TestCaseData waterPressureAsphaltCoverTestCase = testCases[11]; + assessmentSection = (AssessmentSection) waterPressureAsphaltCoverTestCase.Arguments[0]; + WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCover = assessmentSection.WaterPressureAsphaltCover; + AssertAssessmentSection(assessmentSection, waterPressureAsphaltCover); + AssertWaterPressureAsphaltCoverFailureMechanism(expectedManualSectionAssemblyGroup, waterPressureAsphaltCover); + } + private static void AssertAssessmentSection(AssessmentSection assessmentSection, IFailureMechanism relevantFailureMechanism) { @@ -251,5 +351,156 @@ Assert.IsTrue(failureMechanisms.All(fm => !fm.IsRelevant)); CollectionAssert.IsEmpty(failureMechanisms.SelectMany(fm => fm.Sections)); } + + private static T GetSectionResult(IHasSectionResults failureMechanism) where T : FailureMechanismSectionResult + { + return failureMechanism.SectionResults.Single(); + } + + #region FailureMechanisms with probability + + private static void AssertPipingFailureMechanism(double expectedManualProbability, PipingFailureMechanism piping) + { + PipingFailureMechanismSectionResult pipingSectionResult = GetSectionResult(piping); + Assert.IsTrue(pipingSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, pipingSectionResult.ManualAssemblyProbability); + } + + private static void AssertMacroStabilityInwardsFailureMechanism(double expectedManualProbability, MacroStabilityInwardsFailureMechanism macroStabilityInwards) + { + MacroStabilityInwardsFailureMechanismSectionResult macroStabilityInwardsSectionResult = GetSectionResult(macroStabilityInwards); + Assert.IsTrue(macroStabilityInwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, macroStabilityInwardsSectionResult.ManualAssemblyProbability); + } + + private static void AssertGrassCoverErosionInwardsFailureMechanism(double expectedManualProbability, GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwards) + { + GrassCoverErosionInwardsFailureMechanismSectionResult grassCoverErosionInwardsSectionResult = GetSectionResult(grassCoverErosionInwards); + Assert.IsTrue(grassCoverErosionInwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, grassCoverErosionInwardsSectionResult.ManualAssemblyProbability); + } + + private static void AssertClosingStructuresFailureMechanism(double expectedManualProbability, ClosingStructuresFailureMechanism closingStructures) + { + ClosingStructuresFailureMechanismSectionResult closingStructuresSectionResult = GetSectionResult(closingStructures); + Assert.IsTrue(closingStructuresSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, closingStructuresSectionResult.ManualAssemblyProbability); + } + + private static void AssertHeightStructuresFailureMechanism(double expectedManualProbability, HeightStructuresFailureMechanism heightStructures) + { + HeightStructuresFailureMechanismSectionResult heightStructuresSectionResult = GetSectionResult(heightStructures); + Assert.IsTrue(heightStructuresSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, heightStructuresSectionResult.ManualAssemblyProbability); + } + + private static void AssertStabilityPointStructuresFailureMechanism(double expectedManualProbability, StabilityPointStructuresFailureMechanism stabilityPointStructures) + { + StabilityPointStructuresFailureMechanismSectionResult stabilityPointStructuresSectionResult = GetSectionResult(stabilityPointStructures); + Assert.IsTrue(stabilityPointStructuresSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualProbability, stabilityPointStructuresSectionResult.ManualAssemblyProbability); + } + + #endregion + + #region FailureMechanisms without probability + + private static void AssertDuneErosionFailureMechanism(FailureMechanismSectionAssemblyCategoryGroup expectedSectionAssemblyGroup, + DuneErosionFailureMechanism duneErosion) + { + DuneErosionFailureMechanismSectionResult duneErosionSectionResult = GetSectionResult(duneErosion); + Assert.IsTrue(duneErosionSectionResult.UseManualAssembly); + Assert.AreEqual(expectedSectionAssemblyGroup, duneErosionSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertGrassCoverErosionOutwardsFailureMechanism(FailureMechanismSectionAssemblyCategoryGroup expectedSectionAssemblyGroup, + GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards) + { + GrassCoverErosionOutwardsFailureMechanismSectionResult grassCoverErosionOutwardsSectionResult = GetSectionResult(grassCoverErosionOutwards); + Assert.IsTrue(grassCoverErosionOutwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedSectionAssemblyGroup, grassCoverErosionOutwardsSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertWaveImpactAsphaltCoverFailureMechanism(FailureMechanismSectionAssemblyCategoryGroup expectedSectionAssemblyGroup, + WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover) + { + WaveImpactAsphaltCoverFailureMechanismSectionResult waveImpactAsphaltCoverSectionResult = GetSectionResult(waveImpactAsphaltCover); + Assert.IsTrue(waveImpactAsphaltCoverSectionResult.UseManualAssembly); + Assert.AreEqual(expectedSectionAssemblyGroup, waveImpactAsphaltCoverSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertStabilityStoneCoverFailureMechanism(FailureMechanismSectionAssemblyCategoryGroup expectedSectionAssemblyGroup, + StabilityStoneCoverFailureMechanism stabilityStoneCover) + { + StabilityStoneCoverFailureMechanismSectionResult stabilityStoneCoverSectionResult = GetSectionResult(stabilityStoneCover); + Assert.IsTrue(stabilityStoneCoverSectionResult.UseManualAssembly); + Assert.AreEqual(expectedSectionAssemblyGroup, stabilityStoneCoverSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertGrassCoverSlipOffInwardsFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwards) + { + GrassCoverSlipOffInwardsFailureMechanismSectionResult grassCoverSlipOffInwardsSectionResult = GetSectionResult(grassCoverSlipOffInwards); + Assert.IsTrue(grassCoverSlipOffInwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, grassCoverSlipOffInwardsSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertGrassCoverSlipOffOutwardsFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwards) + { + GrassCoverSlipOffOutwardsFailureMechanismSectionResult grassCoverSlipOffOutwardsSectionResult = GetSectionResult(grassCoverSlipOffOutwards); + Assert.IsTrue(grassCoverSlipOffOutwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, grassCoverSlipOffOutwardsSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertPipingStructureFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + PipingStructureFailureMechanism pipingStructure) + { + PipingStructureFailureMechanismSectionResult pipingStructureSectionResult = GetSectionResult(pipingStructure); + Assert.IsTrue(pipingStructureSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, pipingStructureSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertStrengthStabilityLengthWiseConstructionFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + StrengthStabilityLengthwiseConstructionFailureMechanism strengthStabilityLengthwiseConstruction) + { + StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult strengthStabilityLengthwiseConstructionSectionResult = GetSectionResult(strengthStabilityLengthwiseConstruction); + Assert.IsTrue(strengthStabilityLengthwiseConstructionSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, strengthStabilityLengthwiseConstructionSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertTechnicalInnovationFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + TechnicalInnovationFailureMechanism technicalInnovation) + { + TechnicalInnovationFailureMechanismSectionResult technicalInnovationSectionResult = GetSectionResult(technicalInnovation); + Assert.IsTrue(technicalInnovationSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, technicalInnovationSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertMicrostabilityFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + MicrostabilityFailureMechanism microstability) + { + MicrostabilityFailureMechanismSectionResult microstabilitySectionResult = GetSectionResult(microstability); + Assert.IsTrue(microstabilitySectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, microstabilitySectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertMacroStabilityOutwardsFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + MacroStabilityOutwardsFailureMechanism macroStabilityOutwards) + { + MacroStabilityOutwardsFailureMechanismSectionResult macroStabilityOutwardsSectionResult = GetSectionResult(macroStabilityOutwards); + Assert.IsTrue(macroStabilityOutwardsSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, macroStabilityOutwardsSectionResult.ManualAssemblyCategoryGroup); + } + + private static void AssertWaterPressureAsphaltCoverFailureMechanism(ManualFailureMechanismSectionAssemblyCategoryGroup expectedManualSectionAssemblyGroup, + WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCover) + { + WaterPressureAsphaltCoverFailureMechanismSectionResult waterPressureAsphaltCoverSectionResult = GetSectionResult(waterPressureAsphaltCover); + Assert.IsTrue(waterPressureAsphaltCoverSectionResult.UseManualAssembly); + Assert.AreEqual(expectedManualSectionAssemblyGroup, waterPressureAsphaltCoverSectionResult.ManualAssemblyCategoryGroup); + } + + #endregion } } \ No newline at end of file