Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingOutputNodePresenter.cs =================================================================== diff -u -r49b7320ad56bfa60788e8792b79dd537318f68ff -rbbc44cc497cf85875585c8aad671c49b6de4fbc3 --- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingOutputNodePresenter.cs (.../PipingOutputNodePresenter.cs) (revision 49b7320ad56bfa60788e8792b79dd537318f68ff) +++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingOutputNodePresenter.cs (.../PipingOutputNodePresenter.cs) (revision bbc44cc497cf85875585c8aad671c49b6de4fbc3) @@ -41,7 +41,10 @@ return false; } - public void OnNodeRenamed(object nodeData, string newName) {} + public void OnNodeRenamed(object nodeData, string newName) + { + throw new InvalidOperationException(string.Format("Cannot rename tree node of type {0}.", GetType().Name)); + } public void OnNodeChecked(ITreeNode node) {} @@ -80,7 +83,7 @@ public bool RemoveNodeData(object parentNodeData, object nodeData) { - return false; + throw new InvalidOperationException(String.Format("Cannot delete node of type {0}.", GetType().Name)); } } } \ No newline at end of file Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingOutputNodePresenterTest.cs =================================================================== diff -u -r49b7320ad56bfa60788e8792b79dd537318f68ff -rbbc44cc497cf85875585c8aad671c49b6de4fbc3 --- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingOutputNodePresenterTest.cs (.../PipingOutputNodePresenterTest.cs) (revision 49b7320ad56bfa60788e8792b79dd537318f68ff) +++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingOutputNodePresenterTest.cs (.../PipingOutputNodePresenterTest.cs) (revision bbc44cc497cf85875585c8aad671c49b6de4fbc3) @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using DelftTools.Controls; using DelftTools.Shell.Core; using DelftTools.Utils.Collections; @@ -107,6 +108,26 @@ } [Test] + public void OnNodeRenamed_Always_ThrowInvalidOperationException() + { + // Setup + var mocks = new MockRepository(); + var nodeMock = mocks.StrictMock(); + mocks.ReplayAll(); + + var nodePresenter = new PipingSurfaceLineCollectionNodePresenter(); + + // Call + TestDelegate call = () => { nodePresenter.OnNodeRenamed(nodeMock, ""); }; + + // Assert + var exception = Assert.Throws(call); + var expectedMessage = string.Format("Cannot rename tree node of type {0}.", nodePresenter.GetType().Name); + Assert.AreEqual(expectedMessage, exception.Message); + mocks.ReplayAll(); // Expect no calls on tree node + } + + [Test] public void OnNodeChecked_Always_DoNothing() { // Setup @@ -293,16 +314,18 @@ } [Test] - public void RemoveNodeData_Always_ReturnFalse() + public void RemoveNodeData_Always_ThrowsInvalidOperationException() { // Setup var nodePresenter = new PipingOutputNodePresenter(); // Call - bool removalSuccesful = nodePresenter.RemoveNodeData(null, null); + TestDelegate removeAction = () => nodePresenter.RemoveNodeData(null, null); // Assert - Assert.IsFalse(removalSuccesful); + var exception = Assert.Throws(removeAction); + var expectedMessage = string.Format("Cannot delete node of type {0}.", nodePresenter.GetType().Name); + Assert.AreEqual(expectedMessage, exception.Message); } } } \ No newline at end of file