Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsCalculationContext.cs
===================================================================
diff -u -re87c9b5011f0f941594f70f2384877351797d445 -r11e4cd9d892da070b3374027f419d2abc3ea4df9
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsCalculationContext.cs (.../GrassCoverErosionInwardsCalculationContext.cs) (revision e87c9b5011f0f941594f70f2384877351797d445)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsCalculationContext.cs (.../GrassCoverErosionInwardsCalculationContext.cs) (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -37,6 +37,7 @@
/// The instance wrapped by this context object.
/// The failure mechanism which the context belongs to.
/// The assessment section which the calculation belongs to.
+ /// Thrown when any input parameter is null.
public GrassCoverErosionInwardsCalculationContext(GrassCoverErosionInwardsCalculation calculation, GrassCoverErosionInwardsFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
: base(calculation, assessmentSection)
{
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsInputContext.cs
===================================================================
diff -u -r510b9a49197f9bba205844d0311092236356207c -r11e4cd9d892da070b3374027f419d2abc3ea4df9
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsInputContext.cs (.../GrassCoverErosionInwardsInputContext.cs) (revision 510b9a49197f9bba205844d0311092236356207c)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsInputContext.cs (.../GrassCoverErosionInwardsInputContext.cs) (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -36,7 +36,7 @@
/// The calculation item the belongs to.
/// The failure mechanism which the context belongs to.
/// The assessment section which the context belongs to.
- /// When any input parameter is null.
+ /// Thrown when any input parameter is null.
public GrassCoverErosionInwardsInputContext(GrassCoverErosionInwardsInput input,
ICalculation calculation,
GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwardsFailureMechanism,
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationContextTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationContextTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsCalculationContextTest.cs (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -0,0 +1,112 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsCalculationContextTest
+ {
+ private MockRepository mocksRepository;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocksRepository = new MockRepository();
+ }
+
+ [Test]
+ public void ConstructorWithData_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ var calculationMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ var context = new GrassCoverErosionInwardsCalculationContext(calculationMock, failureMechanismMock, assessmentSectionMock);
+
+ // Assert
+ Assert.AreEqual(calculationMock, context.WrappedData);
+ Assert.AreEqual(failureMechanismMock, context.GrassCoverErosionInwardsFailureMechanism);
+ Assert.AreEqual(assessmentSectionMock, context.AssessmentSection);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullCalculation_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanismMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsCalculationContext(null, failureMechanismMock, assessmentSectionMock);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("wrappedData", exception.ParamName);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullFailureMechanism_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculationMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsCalculationContext(calculationMock, null, assessmentSectionMock);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullAssessmentSection_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculationMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsCalculationContext(calculationMock, failureMechanismMock, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ mocksRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsInputContextTest.cs (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -0,0 +1,143 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsInputContextTest
+ {
+ private MockRepository mocksRepository;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocksRepository = new MockRepository();
+ }
+
+ [Test]
+ public void ConstructorWithData_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ var inputMock = mocksRepository.StrictMock();
+ var calculationMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ var context = new GrassCoverErosionInwardsInputContext(inputMock, calculationMock, failureMechanismMock, assessmentSectionMock);
+
+ // Assert
+ Assert.AreEqual(inputMock, context.WrappedData);
+ Assert.AreEqual(calculationMock, context.Calculation);
+ Assert.AreEqual(failureMechanismMock, context.GrassCoverErosionInwardsFailureMechanism);
+ Assert.AreEqual(assessmentSectionMock, context.AssessmentSection);
+ mocksRepository.VerifyAll();
+ }
+
+
+ [Test]
+ public void Constructor_NullInput_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculationMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsInputContext(null, calculationMock, failureMechanismMock, assessmentSectionMock);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("wrappedData", exception.ParamName);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullCalculation_ThrowsArgumentNullException()
+ {
+ // Setup
+ var inputMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsInputContext(inputMock, null, failureMechanismMock, assessmentSectionMock);
+
+ // Assert
+ var message = String.Format(Resources.GrassCoverErosionInwardsContext_AssertInputsAreNotNull_DataDescription_0_cannot_be_null,
+ Resources.GrassCoverErosionInwardsInputContext_DataDescription_GrassCoverErosionInwardsInputCalculationItem);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullFailureMechanism_ThrowsArgumentNullException()
+ {
+ // Setup
+ var inputMock = mocksRepository.StrictMock();
+ var calculationMock = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsInputContext(inputMock, calculationMock, null, assessmentSectionMock);
+
+ // Assert
+ var message = String.Format(Resources.GrassCoverErosionInwardsContext_AssertInputsAreNotNull_DataDescription_0_cannot_be_null,
+ Resources.GrassCoverErosionInwardsContext_DataDescription_GrassCoverErosionInwardsFailureMechanism);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_NullAssessmentSection_ThrowsArgumentNullException()
+ {
+ // Setup
+ var inputMock = mocksRepository.StrictMock();
+ var calculationMock = mocksRepository.StrictMock();
+ var failureMechanismMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GrassCoverErosionInwardsInputContext(inputMock, calculationMock, failureMechanismMock, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ mocksRepository.VerifyAll();
+ }
+
+
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj
===================================================================
diff -u -rc5f90c4f9b42d985f16f99ad8732576b9217267a -r11e4cd9d892da070b3374027f419d2abc3ea4df9
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision c5f90c4f9b42d985f16f99ad8732576b9217267a)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -60,14 +60,18 @@
+
+
+
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyGrassCoverErosionInwardsOutputTreeNodeTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyGrassCoverErosionInwardsOutputTreeNodeTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/EmptyGrassCoverErosionInwardsOutputTreeNodeTest.cs (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -0,0 +1,127 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Plugin;
+using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class EmptyGrassCoverErosionInwardsOutputTreeNodeTest
+ {
+ private MockRepository mocksRepository;
+ private GrassCoverErosionInwardsGuiPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocksRepository = new MockRepository();
+ plugin = new GrassCoverErosionInwardsGuiPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(EmptyGrassCoverErosionInwardsOutput));
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(EmptyGrassCoverErosionInwardsOutput), info.TagType);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsFromResource()
+ {
+ // Call
+ var text = info.Text(null);
+
+ // Assert
+ Assert.AreEqual(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsOutput_DisplayName, text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsPlaceHolderIcon()
+ {
+ // Call
+ var image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image);
+ }
+
+ [Test]
+ public void ForeColor_Always_ReturnsGrayText()
+ {
+ // Call
+ var textColor = info.ForeColor(null);
+
+ // Assert
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), textColor);
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var gui = mocksRepository.StrictMock();
+ var menuBuilderMock = mocksRepository.StrictMock();
+ var treeViewControlMock = mocksRepository.StrictMock();
+
+ menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.Build()).Return(null);
+
+ gui.Expect(cmp => cmp.Get(null, treeViewControlMock)).Return(menuBuilderMock);
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControlMock);
+
+ // Assert
+ mocksRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -re87c9b5011f0f941594f70f2384877351797d445 -r11e4cd9d892da070b3374027f419d2abc3ea4df9
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision e87c9b5011f0f941594f70f2384877351797d445)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -24,7 +24,9 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Plugin;
@@ -35,14 +37,14 @@
[TestFixture]
public class GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest
{
- private MockRepository mocks;
+ private MockRepository mocksRepository;
private GrassCoverErosionInwardsGuiPlugin plugin;
private TreeNodeInfo info;
[SetUp]
public void SetUp()
{
- mocks = new MockRepository();
+ mocksRepository = new MockRepository();
plugin = new GrassCoverErosionInwardsGuiPlugin();
info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsCalculationContext));
}
@@ -72,18 +74,18 @@
};
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var assessmentSectionMock = mocks.StrictMock();
- mocks.ReplayAll();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
- var pipingCalculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
-
+ var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
+
// Call
- var text = info.Text(pipingCalculationContext);
+ var text = info.Text(calculationContext);
// Assert
Assert.AreEqual(testname, text);
- mocks.VerifyAll();
+ mocksRepository.VerifyAll();
}
[Test]
@@ -103,20 +105,46 @@
var calculation = new GrassCoverErosionInwardsCalculation();
var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
- var assessmentSectionMock = mocks.StrictMock();
- mocks.ReplayAll();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
- var pipingCalculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
+ var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
- mocks.ReplayAll();
+ mocksRepository.ReplayAll();
// Call
- var result = info.EnsureVisibleOnCreate(pipingCalculationContext);
+ var result = info.EnsureVisibleOnCreate(calculationContext);
// Assert
Assert.IsTrue(result);
- mocks.VerifyAll();
+ mocksRepository.VerifyAll();
}
+
+ [Test]
+ public void ChildNodeObjects_WithOutputData_ReturnOutputChildNode()
+ {
+ var calculation = mocksRepository.StrictMock();
+ var failureMechanism = mocksRepository.StrictMock();
+ var assessmentSectionMock = mocksRepository.StrictMock();
+ mocksRepository.ReplayAll();
+
+ var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
+
+ // Call
+ var children = info.ChildNodeObjects(calculationContext).ToArray();
+
+ // Assert
+ Assert.AreEqual(3, children.Length);
+ var commentContext = children[0] as CommentContext;
+ Assert.IsNotNull(commentContext);
+ Assert.AreSame(calculationContext.WrappedData, commentContext.CommentContainer);
+
+ var grassCoverErosionInwardsCalculationContext = (GrassCoverErosionInwardsInputContext) children[1];
+ Assert.AreSame(calculationContext.WrappedData.InputParameters, grassCoverErosionInwardsCalculationContext.WrappedData);
+
+ var emptyOutput = (EmptyGrassCoverErosionInwardsOutput) children[2];
+ Assert.IsNotNull(emptyOutput);
+ }
}
-}
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfo.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfo.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfo.cs (revision 11e4cd9d892da070b3374027f419d2abc3ea4df9)
@@ -0,0 +1,141 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Linq;
+using Core.Common.Controls.TreeView;
+using Core.Common.Gui;
+using Core.Common.Gui.ContextMenu;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Plugin;
+using GrassCoverErosionInwardsFormsResources = Ringtoets.GrassCoverErosionInwards.Forms.Properties.Resources;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsInputContextTreeNodeInfo
+ {
+ private MockRepository mocksRepository;
+ private GrassCoverErosionInwardsGuiPlugin plugin;
+ private TreeNodeInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocksRepository = new MockRepository();
+ plugin = new GrassCoverErosionInwardsGuiPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(GrassCoverErosionInwardsInputContext));
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(GrassCoverErosionInwardsInputContext), info.TagType);
+ Assert.IsNull(info.ForeColor);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.IsChecked);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_Always_ReturnsTextFromResource()
+ {
+ // Setup
+ var assessmentSection = mocksRepository.StrictMock();
+ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext(
+ mocksRepository.StrictMock(),
+ mocksRepository.StrictMock(),
+ mocksRepository.StrictMock(),
+ assessmentSection);
+ mocksRepository.ReplayAll();
+
+ // Call
+ var text = info.Text(grassCoverErosionInwardsInputContext);
+
+ // Assert
+ Assert.AreEqual(GrassCoverErosionInwardsFormsResources.GrassCoverErosionInwardsInputContext_NodeDisplayName, text);
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Image_Always_ReturnsSetImage()
+ {
+ // Setup
+ var assessmentSection = mocksRepository.StrictMock();
+ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext(
+ mocksRepository.StrictMock(),
+ mocksRepository.StrictMock(),
+ mocksRepository.StrictMock(),
+ assessmentSection);
+ mocksRepository.ReplayAll();
+
+ // Call
+ var image = info.Image(grassCoverErosionInwardsInputContext);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image);
+
+ mocksRepository.VerifyAll();
+ }
+
+ [Test]
+ public void ContextMenuStrip_Always_CallsBuilder()
+ {
+ // Setup
+ var gui = mocksRepository.StrictMultiMock();
+ var treeViewControl = mocksRepository.StrictMock();
+ var menuBuilderMock = mocksRepository.StrictMock();
+
+ gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock);
+
+ menuBuilderMock.Expect(mb => mb.AddImportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddExportItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock);
+ menuBuilderMock.Expect(mb => mb.Build()).Return(null);
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(null, null, treeViewControl);
+
+ // Assert
+ mocksRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file