Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rbda5bee40c8a756d444e5aeba5907e2617e76f00 -r16b8f1f6aa0aa7bbb18b8741d7a7b7e01f7403e9 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs (.../HydraulicBoundariesGroupContextTreeNodeInfoTest.cs) (revision bda5bee40c8a756d444e5aeba5907e2617e76f00) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/HydraulicBoundariesGroupContextTreeNodeInfoTest.cs (.../HydraulicBoundariesGroupContextTreeNodeInfoTest.cs) (revision 16b8f1f6aa0aa7bbb18b8741d7a7b7e01f7403e9) @@ -29,6 +29,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.GrassCoverErosionOutwards.Data; using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -151,11 +152,12 @@ } [Test] - public void ChildNodeObjects_NoHydraulicBoundaryDatabaseSet_ReturnNoChildNodes() + public void ChildNodeObjects_HydraulicBoundaryDatabaseNotLinked_ReturnNoChildNodes() { // Setup - var assessmentSection = mockRepository.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); @@ -167,12 +169,16 @@ } [Test] - public void ChildNodeObjects_HydraulicBoundaryDatabaseSet_ReturnChildDataNodes() + public void ChildNodeObjects_HydraulicBoundaryDatabaseLinked_ReturnChildDataNodes() { // Setup var assessmentSection = mockRepository.Stub(); + assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase + { + FilePath = "databaseFile" + }); mockRepository.ReplayAll(); - assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); @@ -182,12 +188,12 @@ // Assert Assert.AreEqual(3, children.Length); var waterLevelHydraulicBoundaryLocationsContext = (GrassCoverErosionOutwardsDesignWaterLevelLocationsContext) children[0]; - Assert.AreSame(failureMechanism.HydraulicBoundaryLocations, waterLevelHydraulicBoundaryLocationsContext.WrappedData); + CollectionAssert.AreEqual(failureMechanism.HydraulicBoundaryLocations.Select(hbl => hbl.DesignWaterLevelCalculation1), waterLevelHydraulicBoundaryLocationsContext.WrappedData); Assert.AreSame(failureMechanism, waterLevelHydraulicBoundaryLocationsContext.FailureMechanism); Assert.AreSame(assessmentSection, waterLevelHydraulicBoundaryLocationsContext.AssessmentSection); var waveHeightHydraulicBoundaryLocationsContext = (GrassCoverErosionOutwardsWaveHeightLocationsContext) children[1]; - Assert.AreSame(failureMechanism.HydraulicBoundaryLocations, waveHeightHydraulicBoundaryLocationsContext.WrappedData); + CollectionAssert.AreEqual(failureMechanism.HydraulicBoundaryLocations.Select(hbl => hbl.WaveHeightCalculation1), waveHeightHydraulicBoundaryLocationsContext.WrappedData); Assert.AreSame(failureMechanism, waveHeightHydraulicBoundaryLocationsContext.FailureMechanism); Assert.AreSame(assessmentSection, waveHeightHydraulicBoundaryLocationsContext.AssessmentSection); @@ -199,11 +205,12 @@ } [Test] - public void ForeColor_NoHydraulicBoundaryDatabaseSet_ReturnGrayText() + public void ForeColor_HydraulicBoundaryDatabaseNotLinked_ReturnDisabledColor() { // Setup - var assessmentSection = mockRepository.Stub(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); @@ -215,12 +222,16 @@ } [Test] - public void ForeColor_HydraulicBoundaryDatabaseSet_ReturnControlColor() + public void ForeColor_HydraulicBoundaryDatabaseLinked_ReturnEnabledColor() { // Setup var assessmentSection = mockRepository.Stub(); + assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(new HydraulicBoundaryDatabase + { + FilePath = "databaseFile" + }); mockRepository.ReplayAll(); - assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection);