Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -rd491788b870f9a9d2e08c93b52777f613809a133 -r2aa1338225863d1875dc48cf37e49b9be3561465 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision d491788b870f9a9d2e08c93b52777f613809a133) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 2aa1338225863d1875dc48cf37e49b9be3561465) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -28,7 +29,10 @@ using Core.Common.TestUtil; using NUnit.Extensions.Forms; using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; using Ringtoets.GrassCoverErosionInwards.Data; @@ -59,18 +63,35 @@ } [Test] - public void DefaultConstructor_DefaultValues() + public void Constructor_ExpectedValues() { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + // Call - using (var view = new GrassCoverErosionInwardsFailureMechanismResultView()) + using (var view = new GrassCoverErosionInwardsFailureMechanismResultView(assessmentSection)) { // Assert Assert.IsInstanceOf>(view); Assert.IsNull(view.Data); } + mocks.VerifyAll(); } [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new GrassCoverErosionInwardsFailureMechanismResultView(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] public void GivenFormWithGrassCoverErosionInwardsFailureMechanismResultView_ThenExpectedColumnsAreVisible() { // Call @@ -586,7 +607,7 @@ private GrassCoverErosionInwardsFailureMechanismResultView ShowFailureMechanismResultsView() { - var failureMechanismResultView = new GrassCoverErosionInwardsFailureMechanismResultView(); + var failureMechanismResultView = new GrassCoverErosionInwardsFailureMechanismResultView(new ObservableTestAssessmentSectionStub()); testForm.Controls.Add(failureMechanismResultView); testForm.Show();