Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/HydraulicBoundaryCalculationsViewTest.cs =================================================================== diff -u -r818cad8d6d3258cbc9fc0606b9ceb6e89b038e77 -r3231ed8ab0e37907648b3d168bcfde364674e7d6 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/HydraulicBoundaryCalculationsViewTest.cs (.../HydraulicBoundaryCalculationsViewTest.cs) (revision 818cad8d6d3258cbc9fc0606b9ceb6e89b038e77) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/HydraulicBoundaryCalculationsViewTest.cs (.../HydraulicBoundaryCalculationsViewTest.cs) (revision 3231ed8ab0e37907648b3d168bcfde364674e7d6) @@ -77,43 +77,7 @@ // Assert Assert.DoesNotThrow(test); } - - [Test] - public void GetIllustrationPointControlItems_ViewWithData_ReturnsExpectedControlItems() - { - // Setup - var topLevelIllustrationPoints = new[] - { - new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), - "Regular", - new TestSubMechanismIllustrationPoint()) - }; - - var generalResult = new TestGeneralResultSubMechanismIllustrationPoint(topLevelIllustrationPoints); - var output = new TestHydraulicBoundaryLocationCalculationOutput(generalResult); - - var calculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) - { - Output = output - }; - var calculations = new ObservableList - { - calculation - }; - - TestHydraulicBoundaryCalculationsView view = ShowTestHydraulicBoundaryCalculationsView(calculations); - - // Call - IEnumerable actualControlItems = - view.PublicGetIllustrationPointControlItems(); - - // Assert - IEnumerable expectedControlItems = - CreateControlItems(generalResult); - CollectionAssert.AreEqual(expectedControlItems, actualControlItems, - new IllustrationPointControlItemComparer()); - } - + private static IEnumerable CreateControlItems( GeneralResult generalResult) { Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/LocationCalculationsViewTest.cs =================================================================== diff -u -re923a11bf7b1c797019b44b5bd017d04c1870f32 -r3231ed8ab0e37907648b3d168bcfde364674e7d6 --- Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/LocationCalculationsViewTest.cs (.../LocationCalculationsViewTest.cs) (revision e923a11bf7b1c797019b44b5bd017d04c1870f32) +++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Views/LocationCalculationsViewTest.cs (.../LocationCalculationsViewTest.cs) (revision 3231ed8ab0e37907648b3d168bcfde364674e7d6) @@ -34,7 +34,9 @@ using Rhino.Mocks; using Riskeer.Common.Data.AssessmentSection; using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Data.IllustrationPoints; using Riskeer.Common.Data.TestUtil; +using Riskeer.Common.Data.TestUtil.IllustrationPoints; using Riskeer.Common.Forms.GuiServices; using Riskeer.Common.Forms.TestUtil; using Riskeer.Common.Forms.Views; @@ -365,7 +367,44 @@ // Assert Assert.DoesNotThrow(test); } + + [Test] + public void GetIllustrationPointControlItems_ViewWithData_ReturnsExpectedControlItems() + { + // Setup + var topLevelIllustrationPoints = new[] + { + new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + "Regular", + new TestSubMechanismIllustrationPoint()) + }; + var generalResult = new TestGeneralResultSubMechanismIllustrationPoint(topLevelIllustrationPoints); + var output = new TestHydraulicBoundaryLocationCalculationOutput(generalResult); + + var calculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = output + }; + var calculations = new ObservableList + { + calculation + }; + + TestHydraulicBoundaryCalculationsView view = ShowTestHydraulicBoundaryCalculationsView(calculations); + + // Call + // IEnumerable actualControlItems = + // view.PublicGetIllustrationPointControlItems(); + + // Assert + var illustrationPointControl = (IllustrationPointsControl) view.Controls.Find("illustrationPointsControl", true).First(); + IEnumerable expectedControlItems = CreateControlItems(generalResult); + CollectionAssert.AreEqual(expectedControlItems, illustrationPointControl.Data, + new IllustrationPointControlItemComparer()); + } + + private TestHydraulicBoundaryCalculationsView ShowTestCalculatableView() { var view = new TestHydraulicBoundaryCalculationsView(new ObservableList(), @@ -429,5 +468,20 @@ return null; } } + + private static IEnumerable CreateControlItems( + GeneralResult generalResult) + { + return generalResult.TopLevelIllustrationPoints + .Select(topLevelIllustrationPoint => + { + SubMechanismIllustrationPoint illustrationPoint = topLevelIllustrationPoint.SubMechanismIllustrationPoint; + return new IllustrationPointControlItem(topLevelIllustrationPoint, + topLevelIllustrationPoint.WindDirection.Name, + topLevelIllustrationPoint.ClosingSituation, + illustrationPoint.Stochasts, + illustrationPoint.Beta); + }); + } } } \ No newline at end of file