Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs =================================================================== diff -u -r0a51f20ac93373a43f79bb4c6327bce1d46545c6 -r5e6eacaf76f765ba77febee673e9e94895e46feb --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision 0a51f20ac93373a43f79bb4c6327bce1d46545c6) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Integration.Test/HeightStructuresCalculationServiceIntegrationTest.cs (.../HeightStructuresCalculationServiceIntegrationTest.cs) (revision 5e6eacaf76f765ba77febee673e9e94895e46feb) @@ -46,11 +46,7 @@ { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } + ImportHydraulicBoundaryDatabase(assessmentSection); const string name = ""; @@ -59,7 +55,6 @@ Name = name }; - // Call bool isValid = false; Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); @@ -99,7 +94,6 @@ } }; - // Call bool isValid = false; Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); @@ -121,11 +115,7 @@ { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - using (var importer = new HydraulicBoundaryDatabaseImporter()) - { - importer.Import(assessmentSection, validFilePath); - } + ImportHydraulicBoundaryDatabase(assessmentSection); const string name = ""; @@ -138,7 +128,6 @@ } }; - // Call bool isValid = false; Action call = () => isValid = HeightStructuresCalculationService.Validate(calculation, assessmentSection); @@ -159,17 +148,10 @@ { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + ImportHydraulicBoundaryDatabase(assessmentSection); - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) + assessmentSection.HeightStructures.AddSection(new FailureMechanismSection("test section", new[] { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { new Point2D(0, 0), new Point2D(1, 1) })); @@ -182,11 +164,11 @@ } }; - var failureMechanismSection = failureMechanism.Sections.First(); + var failureMechanismSection = assessmentSection.HeightStructures.Sections.First(); ExceedanceProbabilityCalculationOutput output = null; // Call - Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, failureMechanism.GeneralInput); + Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, assessmentSection.HeightStructures.GeneralInput); // Assert TestHelper.AssertLogMessages(call, messages => @@ -204,17 +186,10 @@ { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); + ImportHydraulicBoundaryDatabase(assessmentSection); - string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); - - using (var importer = new HydraulicBoundaryDatabaseImporter()) + assessmentSection.HeightStructures.AddSection(new FailureMechanismSection("test section", new[] { - importer.Import(assessmentSection, validFilePath); - } - - var failureMechanism = new HeightStructuresFailureMechanism(); - failureMechanism.AddSection(new FailureMechanismSection("test section", new[] - { new Point2D(0, 0), new Point2D(1, 1) })); @@ -227,22 +202,31 @@ } }; - var failureMechanismSection = failureMechanism.Sections.First(); + var failureMechanismSection = assessmentSection.HeightStructures.Sections.First(); ExceedanceProbabilityCalculationOutput output = null; // Call - Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, failureMechanism.GeneralInput); + Action call = () => output = HeightStructuresCalculationService.Calculate(calculation, testDataPath, failureMechanismSection, failureMechanismSection.Name, assessmentSection.HeightStructures.GeneralInput); // Assert TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith(string.Format("Hoogte kunstwerk '{0}' niet gelukt.", calculation.Name), msgs[1]); + StringAssert.StartsWith(string.Format("De berekening voor hoogte kunstwerk '{0}' is niet gelukt.", calculation.Name), msgs[1]); StringAssert.StartsWith(string.Format("Berekening van '{0}' beƫindigd om: ", calculation.Name), msgs[2]); }); Assert.IsNull(output); } + + private void ImportHydraulicBoundaryDatabase(AssessmentSection assessmentSection) + { + string validFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite"); + using (var importer = new HydraulicBoundaryDatabaseImporter()) + { + importer.Import(assessmentSection, validFilePath); + } + } } } \ No newline at end of file