Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs =================================================================== diff -u -r1811626955b35ce3019b250013b92a56f00a561a -rd83bc80d11262310f469ccc3032ffc534af61789 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision 1811626955b35ce3019b250013b92a56f00a561a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision d83bc80d11262310f469ccc3032ffc534af61789) @@ -87,7 +87,7 @@ } [Test] - public void CanRenameNodeOfCalculationGroupContextTreeNodeInfo_ParentIsCalculationGroupContext_ReturnTrue() + public void CanRenameNodeOfCalculationGroupContextTreeNodeInfo_NestedCalculationGroup_ReturnTrue() { // Setup var mocks = new MockRepository(); @@ -108,7 +108,7 @@ } [Test] - public void CanRenameNodeOfCalculationGroupContextTreeNodeInfo_EverythingElse_ReturnFalse() + public void CanRenameNodeOfCalculationGroupContextTreeNodeInfo_WithoutParentNodeDefaultBehavior_ReturnFalse() { // Setup var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); @@ -149,16 +149,34 @@ } [Test] - public void CanRemoveOfCalculationGroupContextTreeNodeInfo_CalculationGroupWithoutParent_ReturnFalse() + public void CanRemoveOfCalculationGroupContextTreeNodeInfo_NestedCalculationGroup_ReturnTrue() { // Setup var mocks = new MockRepository(); var failureMechanismMock = mocks.StrictMock(); mocks.ReplayAll(); - var group = new CalculationGroup(); - var nodeData = new TestCalculationGroupContext(group, failureMechanismMock); + var nodeData = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); + var parentNodeData = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); + // Call + bool isRemovalAllowed = treeNodeInfo.CanRemove(nodeData, parentNodeData); + + // Assert + Assert.IsTrue(isRemovalAllowed); + mocks.VerifyAll(); + } + + [Test] + public void CanRemoveOfCalculationGroupContextTreeNodeInfo_WithoutParentNodeDefaultBehavior_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodeData = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); // Call @@ -170,24 +188,42 @@ } [Test] - public void CanRemoveOfCalculationGroupContextTreeNodeInfo_NestedCalculationGroup_ReturnTrue() + public void CanDragOfCalculationGroupContextTreeNodeInfo_NestedCalculationGroup_ReturnTrue() { // Setup var mocks = new MockRepository(); var failureMechanismMock = mocks.StrictMock(); + mocks.ReplayAll(); - var nodeData = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); - var parentNodeData = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); + var groupContext = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); + var parentGroupContext = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); + // Call + var canDrag = treeNodeInfo.CanDrag(groupContext, parentGroupContext); + + // Assert + Assert.IsTrue(canDrag); + } + + [Test] + public void CanDragOfCalculationGroupContextTreeNodeInfo_WithoutParentNodeDefaultBehavior_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + + mocks.ReplayAll(); + + var groupContext = new TestCalculationGroupContext(new CalculationGroup(), failureMechanismMock); var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(null, null, null); // Call - bool isRemovalAllowed = treeNodeInfo.CanRemove(nodeData, parentNodeData); + var canDrag = treeNodeInfo.CanDrag(groupContext, null); // Assert - Assert.IsTrue(isRemovalAllowed); - mocks.VerifyAll(); + Assert.IsFalse(canDrag); } private class TestCalculationGroupContext : Observable, ICalculationContext