Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -r08ffb114790e941c88d124e7d996b225154fc9b5 -r903d441abc9596fbae24ca98a7d6af633bd616f7 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 08ffb114790e941c88d124e7d996b225154fc9b5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -84,6 +84,7 @@ + Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -0,0 +1,124 @@ +// 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.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionInwards.Data; +using Ringtoets.GrassCoverErosionInwards.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class FailureMechanismSectionResultContextTreeNodeInfoTest + { + private MockRepository mocks; + private GrassCoverErosionInwardsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new GrassCoverErosionInwardsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); + + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + 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_ReturnsName() + { + // Setup + mocks.ReplayAll(); + + var mechanism = new GrassCoverErosionInwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism); + + // Call + var text = info.Text(context); + + // Assert + Assert.AreEqual("Oordeel", text); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rea99af5c043eadf5c2ba83b82a847ae009181191 -r903d441abc9596fbae24ca98a7d6af633bd616f7 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision ea99af5c043eadf5c2ba83b82a847ae009181191) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -67,11 +67,12 @@ + - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CustomFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CustomFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/CustomFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -0,0 +1,146 @@ +// 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.Collections.Generic; +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.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class CustomFailureMechanismSectionResultContextTreeNodeInfoTest + { + private MockRepository mocks; + private RingtoetsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new RingtoetsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); + + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + 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_ReturnsName() + { + // Setup + mocks.ReplayAll(); + + var mechanism = new CustomFailureMechanism(); + var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism); + + // Call + var text = info.Text(context); + + // Assert + Assert.AreEqual("Oordeel", text); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } + + public class CustomFailureMechanism : FailureMechanismBase, IHasSectionResults + { + public CustomFailureMechanism() + : base("N", "C") + { + SectionResults = new List(); + } + + public IEnumerable SectionResults { get; private set; } + + public override IEnumerable Calculations + { + get + { + throw new System.NotImplementedException(); + } + } + } +} \ No newline at end of file Fisheye: Tag 903d441abc9596fbae24ca98a7d6af633bd616f7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/SimpleFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/SimpleFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/SimpleFailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -0,0 +1,146 @@ +// 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.Collections.Generic; +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.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class SimpleFailureMechanismSectionResultContextTreeNodeInfoTest + { + private MockRepository mocks; + private RingtoetsGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new RingtoetsGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); + + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + 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_ReturnsName() + { + // Setup + mocks.ReplayAll(); + + var mechanism = new SimpleFailureMechanism(); + var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism); + + // Call + var text = info.Text(context); + + // Assert + Assert.AreEqual("Oordeel", text); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + gui.Expect(g => g.ProjectOpened += null).IgnoreArguments(); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } + + public class SimpleFailureMechanism : FailureMechanismBase, IHasSectionResults + { + public SimpleFailureMechanism() + : base("N", "C") + { + SectionResults = new List(); + } + + public IEnumerable SectionResults { get; private set; } + + public override IEnumerable Calculations + { + get + { + throw new System.NotImplementedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj =================================================================== diff -u -r2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f -r903d441abc9596fbae24ca98a7d6af633bd616f7 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 2fca3f7ae1037eaa9c355b64d7cd0c390143ea8f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -67,6 +67,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/FailureMechanismSectionResultContextTreeNodeInfoTest.cs (revision 903d441abc9596fbae24ca98a7d6af633bd616f7) @@ -0,0 +1,124 @@ +// 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.Forms.PresentationObjects; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Plugin; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Piping.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class FailureMechanismSectionResultContextTreeNodeInfoTest + { + private MockRepository mocks; + private PipingGuiPlugin plugin; + private TreeNodeInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new PipingGuiPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(FailureMechanismSectionResultContext)); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.TagType); + + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.ForeColor); + Assert.IsNull(info.EnsureVisibleOnCreate); + 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_ReturnsName() + { + // Setup + mocks.ReplayAll(); + + var mechanism = new PipingFailureMechanism(); + var context = new FailureMechanismSectionResultContext(mechanism.SectionResults, mechanism); + + // Call + var text = info.Text(context); + + // Assert + Assert.AreEqual("Oordeel", text); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + var image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image); + } + + [Test] + public void ContextMenuStrip_Always_CallsBuilder() + { + // Setup + var gui = mocks.StrictMultiMock(); + var treeViewControl = mocks.StrictMock(); + var menuBuilderMock = mocks.StrictMock(); + + gui.Expect(g => g.Get(null, treeViewControl)).Return(menuBuilderMock); + + menuBuilderMock.Expect(mb => mb.AddOpenItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(null, null, treeViewControl); + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file