Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/DikeProfilesContextTest.cs =================================================================== diff -u -r30b8231f92b90ea4b05e98e3d0285368f6dfe2e4 -raaad7a7ca8557c045aa8d6d4031be9133d2f34a6 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/DikeProfilesContextTest.cs (.../DikeProfilesContextTest.cs) (revision 30b8231f92b90ea4b05e98e3d0285368f6dfe2e4) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/DikeProfilesContextTest.cs (.../DikeProfilesContextTest.cs) (revision aaad7a7ca8557c045aa8d6d4031be9133d2f34a6) @@ -26,6 +26,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PresentationObjects @@ -41,14 +42,14 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var dikeProfilesList = new ObservableList(); + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); // Call - var context = new DikeProfilesContext(dikeProfilesList, assessmentSection); + var context = new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, assessmentSection); // Assert Assert.IsInstanceOf>>(context); - Assert.AreSame(dikeProfilesList, context.WrappedData); + Assert.AreSame(failureMechanism.DikeProfiles, context.WrappedData); Assert.AreSame(assessmentSection, context.ParentAssessmentSection); mocks.VerifyAll(); } @@ -61,8 +62,10 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + // Call - TestDelegate call = () => new DikeProfilesContext(null, assessmentSection); + TestDelegate call = () => new DikeProfilesContext(null, failureMechanism, assessmentSection); // Assert string paramName = Assert.Throws(call).ParamName; @@ -71,10 +74,32 @@ } [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var dikeProfiles = new ObservableList(); + + // Call + TestDelegate call = () => new DikeProfilesContext(dikeProfiles, null, assessmentSection); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("parentFailureMechanism", paramName); + mocks.VerifyAll(); + } + + [Test] public void Constructor_AssessmentSectionIsNull_ThrowArgumentNullException() { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + // Call - TestDelegate call = () => new DikeProfilesContext(new ObservableList(), null); + TestDelegate call = () => new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, null); // Assert string paramName = Assert.Throws(call).ParamName;