Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs =================================================================== diff -u -r73597729ce18d3ee00d8036bca8341e9c12f2953 -rf80835301ae973b5439593e81fb640b7ab044340 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision 73597729ce18d3ee00d8036bca8341e9c12f2953) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Integration.Test/ClosingStructuresCalculationActivityIntegrationTest.cs (.../ClosingStructuresCalculationActivityIntegrationTest.cs) (revision f80835301ae973b5439593e81fb640b7ab044340) @@ -34,6 +34,7 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.IO.FileImporters; +using Ringtoets.HydraRing.Calculation.TestUtil.Calculator; using Ringtoets.HydraRing.Data; using Ringtoets.Integration.Data; @@ -45,7 +46,7 @@ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); [Test] - public void Run_InValidHeightStructuresCalculationAndRan_PerformHeightStructuresValidationAndCalculationAndLogStartAndEndAndError() + public void Run_ValidClosingStructuresCalculation_PerformClosingStructuresValidationAndCalculationAndLogStartAndEnd() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); @@ -68,6 +69,55 @@ { InputParameters = { + HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), + } + }; + + var activity = new ClosingStructuresCalculationActivity(calculation, testDataPath, failureMechanism, assessmentSection); + using (new HydraRingCalculatorFactoryConfig()) + { + // Call + Action call = () => activity.Run(); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(5, msgs.Length); + StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[2]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[4]); + StringAssert.StartsWith("Kunstwerken sluiten berekeningsverslag. Klik op details voor meer informatie.", msgs[3]); + }); + Assert.AreEqual(ActivityState.Executed, activity.State); + } + } + + [Test] + public void Run_InValidClosingStructuresCalculationAndRan_PerformClosingStructuresValidationAndCalculationAndLogStartAndEndAndError() + { + // 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); + } + + var failureMechanism = new ClosingStructuresFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("test section", new[] + { + new Point2D(0, 0), + new Point2D(1, 1) + })); + + var calculation = new TestClosingStructuresCalculation() + { + InputParameters = + { HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "test", 1, 1), } }; @@ -81,21 +131,19 @@ TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); - Assert.AreEqual(4, msgs.Length); - // TODO: Skeleton for validation -// Assert.AreEqual(6, msgs.Length); -// StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]); -// StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[0]); - StringAssert.StartsWith(string.Format("De berekening voor kunstwerk sluiten '{0}' is niet gelukt.", calculation.Name), msgs[1]); - StringAssert.StartsWith("Kunstwerken sluiten berekeningsverslag. Klik op details voor meer informatie.", msgs[2]); - StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[3]); + Assert.AreEqual(6, msgs.Length); + StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", calculation.Name), msgs[0]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beëindigd om: ", calculation.Name), msgs[1]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' gestart om: ", calculation.Name), msgs[2]); + StringAssert.StartsWith(string.Format("De berekening voor kunstwerk sluiten '{0}' is niet gelukt.", calculation.Name), msgs[3]); + StringAssert.StartsWith("Kunstwerken sluiten berekeningsverslag. Klik op details voor meer informatie.", msgs[4]); + StringAssert.StartsWith(string.Format("Berekening van '{0}' beëindigd om: ", calculation.Name), msgs[5]); }); Assert.AreEqual(ActivityState.Failed, activity.State); } [Test] - public void Finish_ValidHeightStructuresCalculationAndRan_SetsOutputAndNotifyObserversOfHeightStructuresCalculation() + public void Finish_ValidClosingStructuresCalculationAndRan_SetsOutputAndNotifyObserversOfClosingStructuresCalculation() { // Setup var mocks = new MockRepository();