Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r684b8c0ca681ea2da3cc988bd60e9223037e5a16 -r7d242b8efca25dd01d33ba0481d707f7ee4baebd --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 684b8c0ca681ea2da3cc988bd60e9223037e5a16) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 7d242b8efca25dd01d33ba0481d707f7ee4baebd) @@ -66,6 +66,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (revision 7d242b8efca25dd01d33ba0481d707f7ee4baebd) @@ -0,0 +1,108 @@ +// 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 Core.Common.Base; +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.Common.Forms.TreeNodeInfos; + +using RingtoetsFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Common.Forms.Test.TreeNodeInfos +{ + [TestFixture] + public class CalculationTreeNodeInfoFactoryTest + { + [Test] + public void Text_CreatedCalculationGroupContextTreeNodeInfo_AlwaysReturnsWrappedDataName() + { + // Setup + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + + mocks.ReplayAll(); + + var groupName = "testName"; + var group = new CalculationGroup + { + Name = groupName + }; + var groupContext = new TestCalculationGroupContext(group, failureMechanismMock); + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); + + // Call + var text = treeNodeInfo.Text(groupContext); + + // Assert + Assert.AreEqual(groupName, text); + mocks.VerifyAll(); + } + + [Test] + public void Image_CreatedCalculationGroupContextTreeNodeInfo_AlwaysReturnsFolderIcon() + { + // Setup + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); + + // Call + var image = treeNodeInfo.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.GeneralFolderIcon, image); + } + + [Test] + public void EnsureVisibleOnCreate_CreatedCalculationGroupContextTreeNodeInfo_AlwaysReturnsTrue() + { + // Setup + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); + + // Call + var result = treeNodeInfo.EnsureVisibleOnCreate(null); + + // Assert + Assert.IsTrue(result); + } + + private class TestCalculationGroupContext : ICalculationContext + { + public TestCalculationGroupContext(CalculationGroup wrappedData, IFailureMechanism failureMechanism) + { + WrappedData = wrappedData; + FailureMechanism = failureMechanism; + } + + public CalculationGroup WrappedData { get; private set; } + + public IFailureMechanism FailureMechanism { get; private set; } + + public void Attach(IObserver observer) {} + + public void Detach(IObserver observer) {} + + public void NotifyObservers() {} + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rb1a215180352084c8f320439c1893c639917f338 -r7d242b8efca25dd01d33ba0481d707f7ee4baebd --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision b1a215180352084c8f320439c1893c639917f338) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 7d242b8efca25dd01d33ba0481d707f7ee4baebd) @@ -75,62 +75,6 @@ } [Test] - public void Text_Always_ReturnsWrappedDataName() - { - // Setup - var testname = "testName"; - var group = new CalculationGroup - { - Name = testname - }; - var failureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - mocks.ReplayAll(); - - var groupContext = new GrassCoverErosionInwardsCalculationGroupContext(group, - failureMechanismMock, - assessmentSectionMock); - - // Call - var text = info.Text(groupContext); - - // Assert - Assert.AreEqual(testname, text); - mocks.VerifyAll(); - } - - [Test] - public void Image_Always_FolderIcon() - { - // Call - var image = info.Image(null); - - // Assert - TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.GeneralFolderIcon, image); - } - - [Test] - public void EnsureVisibleOnCreate_Always_ReturnsTrue() - { - // Setup - var group = new CalculationGroup(); - var failureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - mocks.ReplayAll(); - - var groupContext = new GrassCoverErosionInwardsCalculationGroupContext(group, - failureMechanismMock, - assessmentSectionMock); - - // Call - var result = info.EnsureVisibleOnCreate(groupContext); - - // Assert - Assert.IsTrue(result); - mocks.VerifyAll(); - } - - [Test] public void ChildNodeObjects_EmptyGroup_ReturnEmpty() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r3ff488a27f75d080db7cf4e13f508ba5555516df -r7d242b8efca25dd01d33ba0481d707f7ee4baebd --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 3ff488a27f75d080db7cf4e13f508ba5555516df) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 7d242b8efca25dd01d33ba0481d707f7ee4baebd) @@ -77,70 +77,6 @@ } [Test] - public void Text_Always_ReturnsWrappedDataName() - { - // Setup - var testname = "testName"; - var group = new CalculationGroup - { - Name = testname - }; - var pipingFailureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - - mocks.ReplayAll(); - - var groupContext = new PipingCalculationGroupContext(group, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanismMock, - assessmentSectionMock); - - // Call - var text = info.Text(groupContext); - - // Assert - Assert.AreEqual(testname, text); - mocks.VerifyAll(); - } - - [Test] - public void Image_Always_FolderIcon() - { - // Call - var image = info.Image(null); - - // Assert - TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.GeneralFolderIcon, image); - } - - [Test] - public void EnsureVisibleOnCreate_Always_ReturnsTrue() - { - // Setup - var group = new CalculationGroup(); - var pipingFailureMechanismMock = mocks.StrictMock(); - var assessmentSectionMock = mocks.StrictMock(); - mocks.ReplayAll(); - - var groupContext = new PipingCalculationGroupContext(group, - Enumerable.Empty(), - Enumerable.Empty(), - pipingFailureMechanismMock, - assessmentSectionMock); - - mocks.ReplayAll(); - - // Call - var result = info.EnsureVisibleOnCreate(groupContext); - - // Assert - Assert.IsTrue(result); - - mocks.VerifyAll(); - } - - [Test] public void ChildNodeObjects_EmptyGroup_ReturnEmpty() { // Setup