Index: Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs =================================================================== diff -u -rb3e587584ceb7389563f3fd460e96f1b3e10506e -rd4a735ae5c24478b3891829ee07c3ea9754226e9 --- Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision b3e587584ceb7389563f3fd460e96f1b3e10506e) +++ Ringtoets/Common/src/Ringtoets.Common.Service/DesignWaterLevelCalculationActivity.cs (.../DesignWaterLevelCalculationActivity.cs) (revision d4a735ae5c24478b3891829ee07c3ea9754226e9) @@ -56,12 +56,12 @@ : base(hydraulicBoundaryLocationCalculation) { messageProvider = new DesignWaterLevelCalculationMessageProvider(categoryBoundaryName); - + this.hydraulicBoundaryLocationCalculation = hydraulicBoundaryLocationCalculation; this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath; this.preprocessorDirectory = preprocessorDirectory; this.norm = norm; - + calculationService = new DesignWaterLevelCalculationService(); Description = messageProvider.GetActivityDescription(hydraulicBoundaryLocationCalculation.HydraulicBoundaryLocation.Name); Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs =================================================================== diff -u -rb3e587584ceb7389563f3fd460e96f1b3e10506e -rd4a735ae5c24478b3891829ee07c3ea9754226e9 --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision b3e587584ceb7389563f3fd460e96f1b3e10506e) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationActivity.cs (.../WaveHeightCalculationActivity.cs) (revision d4a735ae5c24478b3891829ee07c3ea9754226e9) @@ -61,11 +61,10 @@ this.hydraulicBoundaryDatabaseFilePath = hydraulicBoundaryDatabaseFilePath; this.preprocessorDirectory = preprocessorDirectory; this.norm = norm; - + calculationService = new WaveHeightCalculationService(); Description = messageProvider.GetActivityDescription(hydraulicBoundaryLocationCalculation.HydraulicBoundaryLocation.Name); - } protected override bool Validate() Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationsViewTest.cs =================================================================== diff -u -r4100889a7adfd83736d1b63dd19745b9708bc98c -rd4a735ae5c24478b3891829ee07c3ea9754226e9 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationsViewTest.cs (.../DuneLocationCalculationsViewTest.cs) (revision 4100889a7adfd83736d1b63dd19745b9708bc98c) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/Views/DuneLocationCalculationsViewTest.cs (.../DuneLocationCalculationsViewTest.cs) (revision d4a735ae5c24478b3891829ee07c3ea9754226e9) @@ -495,6 +495,8 @@ public void CalculateForSelectedButton_OneCalculationSelected_CalculateForSelectedCalculationAndLogsMessages() { // Setup + const string categoryBoundaryName = "A"; + var assessmentSection = mocks.Stub(); assessmentSection.Stub(a => a.Id).Return("1"); assessmentSection.Stub(a => a.FailureMechanismContribution).Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution()); @@ -518,10 +520,9 @@ using (DuneLocationCalculationsView view = ShowDuneLocationCalculationsView(calculations, failureMechanism, assessmentSection, - "A")) + categoryBoundaryName)) { var dataGridView = (DataGridView) view.Controls.Find("dataGridView", true)[0]; - object originalDataSource = dataGridView.DataSource; DataGridViewRowCollection rows = dataGridView.Rows; rows[0].Cells[calculateColumnIndex].Value = true; @@ -538,21 +539,23 @@ Action action = () => buttonTester.Click(); // Assert + string expectedDuneLocationName = calculations.ElementAt(0).DuneLocation.Name; + TestHelper.AssertLogMessages(action, messages => { List messageList = messages.ToList(); // Assert Assert.AreEqual(8, messageList.Count); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' (Categorie A) is gestart.", messageList[0]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{expectedDuneLocationName}' (Categorie {categoryBoundaryName}) is gestart.", messageList[0]); CalculationServiceTestHelper.AssertValidationStartMessage(messageList[1]); CalculationServiceTestHelper.AssertValidationEndMessage(messageList[2]); CalculationServiceTestHelper.AssertCalculationStartMessage(messageList[3]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie '1' (Categorie A) is niet geconvergeerd.", messageList[4]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{expectedDuneLocationName}' (Categorie {categoryBoundaryName}) is niet geconvergeerd.", messageList[4]); StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[5]); CalculationServiceTestHelper.AssertCalculationEndMessage(messageList[6]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' (Categorie A) is gelukt.", messageList[7]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{expectedDuneLocationName}' (Categorie {categoryBoundaryName}) is gelukt.", messageList[7]); }); } } Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationCalculationsContextTreeNodeInfoTest.cs =================================================================== diff -u -rd3790f2760e56fc3d8b7c814a9ae57aede10f5ba -rd4a735ae5c24478b3891829ee07c3ea9754226e9 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationCalculationsContextTreeNodeInfoTest.cs (.../DuneLocationCalculationsContextTreeNodeInfoTest.cs) (revision d3790f2760e56fc3d8b7c814a9ae57aede10f5ba) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/TreeNodeInfos/DuneLocationCalculationsContextTreeNodeInfoTest.cs (.../DuneLocationCalculationsContextTreeNodeInfoTest.cs) (revision d4a735ae5c24478b3891829ee07c3ea9754226e9) @@ -337,19 +337,23 @@ public void ContextMenuStrip_ClickOnCalculateAllItem_ScheduleAllCalculationsAndNotifyObservers() { // Setup + const string categoryBoundaryName = "A"; + const string locationName1 = "1"; + const string locationName2 = "2"; + using (var treeViewControl = new TreeViewControl()) { string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); var duneLocationCalculations = new ObservableList { - new DuneLocationCalculation(new DuneLocation(1300001, "1", new Point2D(0, 0), new DuneLocation.ConstructionProperties + new DuneLocationCalculation(new DuneLocation(1300001, locationName1, new Point2D(0, 0), new DuneLocation.ConstructionProperties { CoastalAreaId = 0, Offset = 0, Orientation = 0, D50 = 0.000007 })), - new DuneLocationCalculation(new DuneLocation(1300002, "2", new Point2D(0, 0), new DuneLocation.ConstructionProperties + new DuneLocationCalculation(new DuneLocation(1300002, locationName2, new Point2D(0, 0), new DuneLocation.ConstructionProperties { CoastalAreaId = 0, Offset = 0, @@ -384,7 +388,7 @@ failureMechanism, assessmentSection, () => 0.01, - "A"); + categoryBoundaryName); var builder = new CustomItemsOnlyContextMenuBuilder(); @@ -420,23 +424,23 @@ // Assert Assert.AreEqual(16, messageList.Count); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' (Categorie A) is gestart.", messageList[0]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{locationName1}' (Categorie {categoryBoundaryName}) is gestart.", messageList[0]); CalculationServiceTestHelper.AssertValidationStartMessage(messageList[1]); CalculationServiceTestHelper.AssertValidationEndMessage(messageList[2]); CalculationServiceTestHelper.AssertCalculationStartMessage(messageList[3]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie '1' (Categorie A) is niet geconvergeerd.", messageList[4]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{locationName1}' (Categorie {categoryBoundaryName}) is niet geconvergeerd.", messageList[4]); StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[5]); CalculationServiceTestHelper.AssertCalculationEndMessage(messageList[6]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '1' (Categorie A) is gelukt.", messageList[7]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{locationName1}' (Categorie {categoryBoundaryName}) is gelukt.", messageList[7]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '2' (Categorie A) is gestart.", messageList[8]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{locationName2}' (Categorie {categoryBoundaryName}) is gestart.", messageList[8]); CalculationServiceTestHelper.AssertValidationStartMessage(messageList[9]); CalculationServiceTestHelper.AssertValidationEndMessage(messageList[10]); CalculationServiceTestHelper.AssertCalculationStartMessage(messageList[11]); - Assert.AreEqual("Hydraulische randvoorwaarden berekening voor locatie '2' (Categorie A) is niet geconvergeerd.", messageList[12]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekening voor locatie '{locationName2}' (Categorie {categoryBoundaryName}) is niet geconvergeerd.", messageList[12]); StringAssert.StartsWith("Hydraulische randvoorwaarden berekening is uitgevoerd op de tijdelijke locatie", messageList[13]); CalculationServiceTestHelper.AssertCalculationEndMessage(messageList[14]); - Assert.AreEqual("Hydraulische randvoorwaarden berekenen voor locatie '2' (Categorie A) is gelukt.", messageList[15]); + Assert.AreEqual($"Hydraulische randvoorwaarden berekenen voor locatie '{locationName2}' (Categorie {categoryBoundaryName}) is gelukt.", messageList[15]); }); } }