Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs =================================================================== diff -u -r521d10695326519942a95db0d8746da32c586668 -r49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs (.../IHasGeneralInputCreateExtensionsTest.cs) (revision 521d10695326519942a95db0d8746da32c586668) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Create/IHasGeneralInputCreateExtensionsTest.cs (.../IHasGeneralInputCreateExtensionsTest.cs) (revision 49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea) @@ -33,11 +33,13 @@ public class IHasGeneralInputCreateExtensionsTest { [Test] - public void Create_Always_ReturnsExpectedMetaEntity() + public void Create_WithAllData_SetsMetaEntityProperties() { // Setup var mocks = new MockRepository(); var failureMechanism = mocks.Stub(); + mocks.ReplayAll(); + failureMechanism.GeneralInput.N = new Random().NextRoundedDouble(1, 20); // Call @@ -46,6 +48,8 @@ // Assert Assert.IsInstanceOf(metaEntity); Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N); + + mocks.VerifyAll(); } private class TestFailureMechanismMetaEntity : IStandAloneFailureMechanismMetaEntity Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r5340caf346e9841667fcb42b8562acfa63bda55b -r49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 5340caf346e9841667fcb42b8562acfa63bda55b) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea) @@ -1059,48 +1059,48 @@ microstability.InAssemblyOutputComments, microstability.NotInAssemblyComments, microstability.CalculationsInputComments, - section.Microstability); - Assert.AreEqual(microstability.MicrostabilityFailureMechanismMetaEntities.Single().N, section.Microstability.GeneralInput.N); + section.Microstability, + microstability.MicrostabilityFailureMechanismMetaEntities.Single().N); AssertFailureMechanismEqual(strengthAndStabilityParallelConstructionInAssembly, strengthAndStabilityParallelConstruction.InAssemblyInputComments, strengthAndStabilityParallelConstruction.InAssemblyOutputComments, strengthAndStabilityParallelConstruction.NotInAssemblyComments, strengthAndStabilityParallelConstruction.CalculationsInputComments, - section.StrengthStabilityLengthwiseConstruction); - Assert.AreEqual(strengthAndStabilityParallelConstruction.StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntities.Single().N, section.StrengthStabilityLengthwiseConstruction.GeneralInput.N); + section.StrengthStabilityLengthwiseConstruction, + strengthAndStabilityParallelConstruction.StrengthStabilityLengthwiseConstructionFailureMechanismMetaEntities.Single().N); AssertFailureMechanismEqual(waterOverpressureAsphaltRevetmentInAssembly, waterOverpressureAsphaltRevetment.InAssemblyInputComments, waterOverpressureAsphaltRevetment.InAssemblyOutputComments, waterOverpressureAsphaltRevetment.NotInAssemblyComments, waterOverpressureAsphaltRevetment.CalculationsInputComments, - section.WaterPressureAsphaltCover); - Assert.AreEqual(waterOverpressureAsphaltRevetment.WaterPressureAsphaltCoverFailureMechanismMetaEntities.Single().N, section.WaterPressureAsphaltCover.GeneralInput.N); + section.WaterPressureAsphaltCover, + waterOverpressureAsphaltRevetment.WaterPressureAsphaltCoverFailureMechanismMetaEntities.Single().N); AssertFailureMechanismEqual(grassRevetmentSlidingOutwardsInAssembly, grassRevetmentSlidingOutwards.InAssemblyInputComments, grassRevetmentSlidingOutwards.InAssemblyOutputComments, grassRevetmentSlidingOutwards.NotInAssemblyComments, grassRevetmentSlidingOutwards.CalculationsInputComments, - section.GrassCoverSlipOffOutwards); - Assert.AreEqual(grassRevetmentSlidingOutwards.GrassCoverSlipOffOutwardsFailureMechanismMetaEntities.Single().N, section.GrassCoverSlipOffOutwards.GeneralInput.N); + section.GrassCoverSlipOffOutwards, + grassRevetmentSlidingOutwards.GrassCoverSlipOffOutwardsFailureMechanismMetaEntities.Single().N); AssertFailureMechanismEqual(grassRevetmentSlidingInwardsInAssembly, grassRevetmentSlidingInwards.InAssemblyInputComments, grassRevetmentSlidingInwards.InAssemblyOutputComments, grassRevetmentSlidingInwards.NotInAssemblyComments, grassRevetmentSlidingInwards.CalculationsInputComments, - section.GrassCoverSlipOffInwards); - Assert.AreEqual(grassRevetmentSlidingInwards.GrassCoverSlipOffInwardsFailureMechanismMetaEntities.Single().N, section.GrassCoverSlipOffInwards.GeneralInput.N); + section.GrassCoverSlipOffInwards, + grassRevetmentSlidingInwards.GrassCoverSlipOffInwardsFailureMechanismMetaEntities.Single().N); AssertFailureMechanismEqual(technicalInnovationsInAssembly, technicalInnovation.InAssemblyInputComments, technicalInnovation.InAssemblyOutputComments, technicalInnovation.NotInAssemblyComments, technicalInnovation.CalculationsInputComments, - section.TechnicalInnovation); - Assert.AreEqual(technicalInnovation.TechnicalInnovationFailureMechanismMetaEntities.Single().N, section.TechnicalInnovation.GeneralInput.N); + section.TechnicalInnovation, + technicalInnovation.TechnicalInnovationFailureMechanismMetaEntities.Single().N); } [Test] @@ -1328,14 +1328,15 @@ private static void AssertFailureMechanismEqual(bool expectedInAssembly, string expectedInAssemblyInputComments, string expectedInAssemblyOutputComments, string expectedNotInAssemblyComments, string expectedCalculationsInputComments, - IFailureMechanism failureMechanism) + IHasGeneralInput failureMechanism, double n) { Assert.AreEqual(expectedInAssembly, failureMechanism.InAssembly); Assert.AreEqual(expectedInAssemblyInputComments, failureMechanism.InAssemblyInputComments.Body); Assert.AreEqual(expectedInAssemblyOutputComments, failureMechanism.InAssemblyOutputComments.Body); Assert.AreEqual(expectedNotInAssemblyComments, failureMechanism.NotInAssemblyComments.Body); Assert.AreEqual(expectedCalculationsInputComments, failureMechanism.CalculationsInputComments.Body); Assert.IsNull(failureMechanism.FailureMechanismSectionSourcePath); + Assert.AreEqual(failureMechanism.GeneralInput.N, (RoundedDouble) n); } } } \ No newline at end of file Index: Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u -rb0659134a0667f5f57838c57b9be8f436fdf3640 -r49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea --- Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs (.../StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs) (revision b0659134a0667f5f57838c57b9be8f436fdf3640) +++ Riskeer/Storage/test/Riskeer.Storage.Core.Test/Read/StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs (.../StandAloneFailureMechanismMetaEntityReadExtensionsTest.cs) (revision 49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea) @@ -62,14 +62,14 @@ } [Test] - public void Read_Always_SetsGeneralInput() + public void Read_WithAllData_SetsGeneralInputProperties() { // Setup var mocks = new MockRepository(); var entity = mocks.Stub(); - entity.N = 4.0; mocks.ReplayAll(); + entity.N = 4.0; var generalInput = new GeneralInput(); // Call Index: Riskeer/Storage/test/Riskeer.Storage.Core.TestUtil/RiskeerProjectTestHelper.cs =================================================================== diff -u -raeaad7fda8412f097e5fc0c5323cfbae4352072f -r49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea --- Riskeer/Storage/test/Riskeer.Storage.Core.TestUtil/RiskeerProjectTestHelper.cs (.../RiskeerProjectTestHelper.cs) (revision aeaad7fda8412f097e5fc0c5323cfbae4352072f) +++ Riskeer/Storage/test/Riskeer.Storage.Core.TestUtil/RiskeerProjectTestHelper.cs (.../RiskeerProjectTestHelper.cs) (revision 49bb18fa968cd0ce2fdb8197afb4d3beb63f7dea) @@ -199,21 +199,37 @@ SetSectionResults(pipingStructureFailureMechanism.SectionResultsOld); MicrostabilityFailureMechanism microstabilityFailureMechanism = assessmentSection.Microstability; - microstabilityFailureMechanism.GeneralInput.N = (RoundedDouble) 2.0; - SetSections(assessmentSection.Microstability); - SetSectionResults(assessmentSection.Microstability.SectionResultsOld); - SetSections(assessmentSection.WaterPressureAsphaltCover); - SetSectionResults(assessmentSection.WaterPressureAsphaltCover.SectionResultsOld); - SetSections(assessmentSection.GrassCoverSlipOffInwards); - SetSectionResults(assessmentSection.GrassCoverSlipOffInwards.SectionResultsOld); - SetSections(assessmentSection.GrassCoverSlipOffOutwards); - SetSectionResults(assessmentSection.GrassCoverSlipOffOutwards.SectionResultsOld); - SetSections(assessmentSection.StrengthStabilityLengthwiseConstruction); - SetSectionResults(assessmentSection.StrengthStabilityLengthwiseConstruction.SectionResultsOld); + microstabilityFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(microstabilityFailureMechanism); + SetSectionResults(microstabilityFailureMechanism.SectionResultsOld); + + WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCoverFailureMechanism = assessmentSection.WaterPressureAsphaltCover; + waterPressureAsphaltCoverFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(waterPressureAsphaltCoverFailureMechanism); + SetSectionResults(waterPressureAsphaltCoverFailureMechanism.SectionResultsOld); + + GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwardsFailureMechanism = assessmentSection.GrassCoverSlipOffInwards; + grassCoverSlipOffInwardsFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(grassCoverSlipOffInwardsFailureMechanism); + SetSectionResults(grassCoverSlipOffInwardsFailureMechanism.SectionResultsOld); + + GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwardsFailureMechanism = assessmentSection.GrassCoverSlipOffOutwards; + grassCoverSlipOffOutwardsFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(grassCoverSlipOffOutwardsFailureMechanism); + SetSectionResults(grassCoverSlipOffOutwardsFailureMechanism.SectionResultsOld); + + StrengthStabilityLengthwiseConstructionFailureMechanism strengthStabilityLengthwiseConstructionFailureMechanism = assessmentSection.StrengthStabilityLengthwiseConstruction; + strengthStabilityLengthwiseConstructionFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(strengthStabilityLengthwiseConstructionFailureMechanism); + SetSectionResults(strengthStabilityLengthwiseConstructionFailureMechanism.SectionResultsOld); + SetSectionResults(assessmentSection.DuneErosion.SectionResultsOld); - SetSections(assessmentSection.TechnicalInnovation); - SetSectionResults(assessmentSection.TechnicalInnovation.SectionResultsOld); + TechnicalInnovationFailureMechanism technicalInnovationFailureMechanism = assessmentSection.TechnicalInnovation; + technicalInnovationFailureMechanism.GeneralInput.N = random.NextRoundedDouble(1, 20); + SetSections(technicalInnovationFailureMechanism); + SetSectionResults(technicalInnovationFailureMechanism.SectionResultsOld); + assessmentSection.GetFailureMechanisms().ForEachElementDo(SetComments); IEnumerable failurePaths = Enumerable.Repeat(new SpecificFailurePath(), random.Next(1, 10)) @@ -1254,7 +1270,7 @@ { sectionConfiguration.ScenarioConfigurationType = random.NextEnumValue(); } - } + } private static PipingSurfaceLine GetSurfaceLine() { @@ -1269,11 +1285,11 @@ new Point3D(5.8, 6.0, -2.3), // Dike toe at river new Point3D(5.6, 6.0, 3.4), new Point3D(4.2, 6.0, 3.5), - new Point3D(4.0, 6.0, 0.5), // Dike toe at polder - new Point3D(3.8, 6.0, 0.5), // Ditch dike side - new Point3D(3.6, 6.0, 0.2), // Bottom ditch dike side + new Point3D(4.0, 6.0, 0.5), // Dike toe at polder + new Point3D(3.8, 6.0, 0.5), // Ditch dike side + new Point3D(3.6, 6.0, 0.2), // Bottom ditch dike side new Point3D(3.4, 6.0, 0.25), // Bottom ditch polder side - new Point3D(3.2, 6.0, 0.5), // Ditch polder side + new Point3D(3.2, 6.0, 0.5), // Ditch polder side new Point3D(3.0, 6.0, 0.5) }; surfaceLine.SetGeometry(geometryPoints);