Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs =================================================================== diff -u -r8b60c9e846480f3ffeeb263bfea5d3367bf6bee3 -rfcfad01f406d6c59c4a3c1de1e75040cd534ab91 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs (.../RingtoetsContextMenuBuilderTest.cs) (revision 8b60c9e846480f3ffeeb263bfea5d3367bf6bee3) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs (.../RingtoetsContextMenuBuilderTest.cs) (revision fcfad01f406d6c59c4a3c1de1e75040cd534ab91) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -797,6 +798,51 @@ #endregion + #region AddDuplicateCalculationItem + + [Test] + public void AddDuplicateCalculationItem_WhenBuildWithCalculationWithOutput_ItemAddedToContextMenuEnabled() + { + // Setup + var mocks = new MockRepository(); + var applicationFeatureCommands = mocks.StrictMock(); + var importCommandHandler = mocks.StrictMock(); + var exportCommandHandler = mocks.StrictMock(); + var updateCommandHandler = mocks.StrictMock(); + var viewCommands = mocks.StrictMock(); + var calculation = mocks.Stub(); + var calculationContext = mocks.Stub>(); + + mocks.ReplayAll(); + + using (var treeViewControl = new TreeViewControl()) + { + var contextMenuBuilder = new ContextMenuBuilder(applicationFeatureCommands, + importCommandHandler, + exportCommandHandler, + updateCommandHandler, + viewCommands, + calculation, + treeViewControl); + var ringtoetsContextMenuBuilder = new RingtoetsContextMenuBuilder(contextMenuBuilder); + + // Call + ContextMenuStrip result = ringtoetsContextMenuBuilder.AddDuplicateCalculationItem(calculation, calculationContext).Build(); + + // Assert + Assert.IsInstanceOf(result); + Assert.AreEqual(1, result.Items.Count); + + TestHelper.AssertContextMenuStripContainsItem(result, 0, + "D&upliceren", + "Dupliceer deze berekening.", + RingtoetsFormsResources.CopyHS); + } + mocks.VerifyAll(); + } + + #endregion + #region AddPerformCalculationItem [Test] @@ -1845,6 +1891,8 @@ public interface ICalculationInputWithForeshoreProfile : ICalculationInput, IHasForeshoreProfile {} + public interface ICloneableCalculation : ICalculation, ICloneable { } + #endregion } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs =================================================================== diff -u -r22c5092409b8d4cf1be4d3ebfdd41169c0e64c14 -rfcfad01f406d6c59c4a3c1de1e75040cd534ab91 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision 22c5092409b8d4cf1be4d3ebfdd41169c0e64c14) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision fcfad01f406d6c59c4a3c1de1e75040cd534ab91) @@ -619,7 +619,7 @@ } }, "Kopie van Nieuwe berekening") - .SetName("NameOfStandardCopyUnique"); + .SetName("NameOfDefaultCopyUnique"); yield return new TestCaseData(calculation, new CalculationGroup { @@ -633,7 +633,7 @@ } }, "Kopie van Nieuwe berekening (1)") - .SetName("NameOfStandardCopySameAsOtherCalculation"); + .SetName("NameOfDefaultCopySameAsOtherCalculation"); yield return new TestCaseData(calculation, new CalculationGroup { @@ -647,7 +647,7 @@ } }, "Kopie van Nieuwe berekening (1)") - .SetName("NameOfStandardCopySameAsOtherCalculationGroup"); + .SetName("NameOfDefaultCopySameAsOtherCalculationGroup"); } } @@ -694,10 +694,10 @@ toolStripItem.PerformClick(); // Assert - ICalculationBase copiedItem = calculationGroup.Children.Except(originalChildren).SingleOrDefault(); - Assert.IsNotNull(copiedItem); - Assert.AreEqual(expectedCalculationName, copiedItem.Name); - Assert.AreEqual(originalChildren.IndexOf(calculation) + 1, calculationGroup.Children.IndexOf(copiedItem)); + ICalculationBase duplicatedItem = calculationGroup.Children.Except(originalChildren).SingleOrDefault(); + Assert.IsNotNull(duplicatedItem); + Assert.AreEqual(expectedCalculationName, duplicatedItem.Name); + Assert.AreEqual(originalChildren.IndexOf(calculation) + 1, calculationGroup.Children.IndexOf(duplicatedItem)); mocks.VerifyAll(); }