Index: src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs
===================================================================
diff -u
--- src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs (revision 0)
+++ src/Plugins/Wti/Wti.Data/PipingFailureMechanism.cs (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Wti.Data
+{
+ ///
+ /// Model for performing piping calculations.
+ ///
+ public class PipingFailureMechanism
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public PipingFailureMechanism()
+ {
+ SurfaceLines = Enumerable.Empty();
+ }
+
+ ///
+ /// Gets the available surface lines within the scope of the piping failure mechanism.
+ ///
+ public IEnumerable SurfaceLines { get; private set; }
+ }
+}
\ No newline at end of file
Index: src/Plugins/Wti/Wti.Data/PipingSurfaceLine.cs
===================================================================
diff -u
--- src/Plugins/Wti/Wti.Data/PipingSurfaceLine.cs (revision 0)
+++ src/Plugins/Wti/Wti.Data/PipingSurfaceLine.cs (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -0,0 +1,7 @@
+namespace Wti.Data
+{
+ public class PipingSurfaceLine
+ {
+
+ }
+}
\ No newline at end of file
Index: src/Plugins/Wti/Wti.Data/Wti.Data.csproj
===================================================================
diff -u -rb9fb2479ca915755aa087e7898b9a78eb1e4f0c0 -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be
--- src/Plugins/Wti/Wti.Data/Wti.Data.csproj (.../Wti.Data.csproj) (revision b9fb2479ca915755aa087e7898b9a78eb1e4f0c0)
+++ src/Plugins/Wti/Wti.Data/Wti.Data.csproj (.../Wti.Data.csproj) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -40,7 +40,9 @@
Properties\GlobalAssembly.cs
+
+
Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs
===================================================================
diff -u
--- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs (revision 0)
+++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSurfaceLineCollectionNodePresenter.cs (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -0,0 +1,117 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+
+using DelftTools.Controls;
+using DelftTools.Utils.Collections;
+
+using Wti.Data;
+using Wti.Forms.Properties;
+
+namespace Wti.Forms.NodePresenters
+{
+ ///
+ /// Tree node presenter representing the collection of surfacelines available for piping
+ /// calculations.
+ ///
+ public class PipingSurfaceLineCollectionNodePresenter : ITreeNodePresenter
+ {
+ public ITreeView TreeView { get; set; }
+
+ public Type NodeTagType
+ {
+ get
+ {
+ return typeof(IEnumerable);
+ }
+ }
+
+ public void UpdateNode(ITreeNode parentNode, ITreeNode node, object nodeData)
+ {
+ node.Text = Resources.PipingSurfaceLinesCollectionName;
+ node.ForegroundColor = Color.FromKnownColor(KnownColor.GrayText);
+ node.Image = Resources.folder;
+ }
+
+ public IEnumerable GetChildNodeObjects(object parentNodeData, ITreeNode node)
+ {
+ var surfaceLines = (IEnumerable)parentNodeData;
+ foreach (var pipingSurfaceLine in surfaceLines)
+ {
+ yield return pipingSurfaceLine;
+ }
+ }
+
+ public bool CanRenameNode(ITreeNode node)
+ {
+ return false;
+ }
+
+ public bool CanRenameNodeTo(ITreeNode node, string newName)
+ {
+ return false;
+ }
+
+ 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)
+ {
+
+ }
+
+ public DragOperations CanDrag(object nodeData)
+ {
+ return DragOperations.None;
+ }
+
+ public DragOperations CanDrop(object item, ITreeNode sourceNode, ITreeNode targetNode, DragOperations validOperations)
+ {
+ return DragOperations.None;
+ }
+
+ public bool CanInsert(object item, ITreeNode sourceNode, ITreeNode targetNode)
+ {
+ return false;
+ }
+
+ public void OnDragDrop(object item, object sourceParentNodeData, object targetParentNodeData, DragOperations operation, int position)
+ {
+
+ }
+
+ public void OnNodeSelected(object nodeData)
+ {
+
+ }
+
+ public IMenuItem GetContextMenu(ITreeNode sender, object nodeData)
+ {
+ return null;
+ }
+
+ public void OnPropertyChanged(object sender, ITreeNode node, PropertyChangedEventArgs e)
+ {
+
+ }
+
+ public void OnCollectionChanged(object sender, NotifyCollectionChangingEventArgs e)
+ {
+
+ }
+
+ public bool CanRemove(object parentNodeData, object nodeData)
+ {
+ return false;
+ }
+
+ public bool RemoveNodeData(object parentNodeData, object nodeData)
+ {
+ throw new InvalidOperationException(String.Format("Cannot delete node of type {0}.", GetType().Name));
+ }
+ }
+}
\ No newline at end of file
Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r957e76e82009f3a67e7754011ce89efa0b4aa4e4 -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be
--- src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 957e76e82009f3a67e7754011ce89efa0b4aa4e4)
+++ src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -79,6 +79,16 @@
}
///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ public static System.Drawing.Bitmap folder {
+ get {
+ object obj = ResourceManager.GetObject("folder", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Peil dat gebruikt moet worden in de toetsing..
///
public static string PipingDataAssessmentLevelDescription {
@@ -638,6 +648,15 @@
}
///
+ /// Looks up a localized string similar to Dwarsdoorsneden.
+ ///
+ public static string PipingSurfaceLinesCollectionName {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCollectionName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
public static System.Drawing.Bitmap WtiProjectFolderIcon {
Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.resx
===================================================================
diff -u -r957e76e82009f3a67e7754011ce89efa0b4aa4e4 -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be
--- src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision 957e76e82009f3a67e7754011ce89efa0b4aa4e4)
+++ src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -123,6 +123,10 @@
Piping berekening niet gelukt: {0}
+
+
+ ..\Resources\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
Peil dat gebruikt moet worden in de toetsing.
@@ -264,7 +268,6 @@
Coëfficiënt van White
-
..\Resources\control_equalizer_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -310,6 +313,9 @@
Z-waarde opbarsten
+
+ Dwarsdoorsneden
+
..\Resources\folder-stand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Index: src/Plugins/Wti/Wti.Forms/Resources/folder.png
===================================================================
diff -u
Binary files differ
Index: src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj
===================================================================
diff -u -rb9fb2479ca915755aa087e7898b9a78eb1e4f0c0 -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be
--- src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj (.../Wti.Forms.csproj) (revision b9fb2479ca915755aa087e7898b9a78eb1e4f0c0)
+++ src/Plugins/Wti/Wti.Forms/Wti.Forms.csproj (.../Wti.Forms.csproj) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -43,6 +43,7 @@
+
@@ -102,6 +103,9 @@
+
+
+
Index: test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs
===================================================================
diff -u
--- test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs (revision 0)
+++ test/Plugins/Wti/Wti.Data.Test/PipingFailureMechanismTest.cs (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -0,0 +1,18 @@
+using NUnit.Framework;
+
+namespace Wti.Data.Test
+{
+ [TestFixture]
+ public class PipingFailureMechanismTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // call
+ var piping = new PipingFailureMechanism();
+
+ // assert
+ CollectionAssert.IsEmpty(piping.SurfaceLines);
+ }
+ }
+}
\ No newline at end of file
Index: test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj
===================================================================
diff -u -r7245ba23f1a696b772b9dc57ea4f92ac822c17f3 -rb08cd825acc24d8d7b0f5e802bf65efece7ee4be
--- test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj (.../Wti.Data.Test.csproj) (revision 7245ba23f1a696b772b9dc57ea4f92ac822c17f3)
+++ test/Plugins/Wti/Wti.Data.Test/Wti.Data.Test.csproj (.../Wti.Data.Test.csproj) (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -47,6 +47,7 @@
+
Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs
===================================================================
diff -u
--- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs (revision 0)
+++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSurfaceLineCollectionNodePresenterTest.cs (revision b08cd825acc24d8d7b0f5e802bf65efece7ee4be)
@@ -0,0 +1,345 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Linq;
+
+using DelftTools.Controls;
+using DelftTools.Utils.Collections;
+
+using NUnit.Framework;
+
+using Rhino.Mocks;
+
+using Wti.Data;
+using Wti.Forms.NodePresenters;
+
+using WtiFormsResources = Wti.Forms.Properties.Resources;
+
+namespace Wti.Forms.Test.NodePresenters
+{
+ [TestFixture]
+ public class PipingSurfaceLineCollectionNodePresenterTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ // Assert
+ Assert.IsInstanceOf(nodePresenter);
+ Assert.IsNull(nodePresenter.TreeView);
+ Assert.AreEqual(typeof(IEnumerable), nodePresenter.NodeTagType);
+ }
+
+ [Test]
+ public void UpdateNode_WithData_InitializeNode()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var surfaceLinesCollectionNodeMock = mocks.Stub();
+ mocks.ReplayAll();
+
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ IEnumerable surfaceLinesCollection = Enumerable.Empty();
+
+ // Call
+ nodePresenter.UpdateNode(null, surfaceLinesCollectionNodeMock, surfaceLinesCollection);
+
+ // Assert
+ Assert.AreEqual(WtiFormsResources.PipingSurfaceLinesCollectionName, surfaceLinesCollectionNodeMock.Text);
+ Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), surfaceLinesCollectionNodeMock.ForegroundColor);
+ Assert.AreEqual(16, surfaceLinesCollectionNodeMock.Image.Height);
+ Assert.AreEqual(16, surfaceLinesCollectionNodeMock.Image.Width);
+ }
+
+ [Test]
+ public void GetChildNodeObjects_WithData_ReturnAllItemsInCollection()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var nodeMock = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ IEnumerable surfaceLinesCollection = new[]
+ {
+ new PipingSurfaceLine(),
+ new PipingSurfaceLine()
+ };
+
+ // Call
+ var children = nodePresenter.GetChildNodeObjects(surfaceLinesCollection, nodeMock);
+
+ // Assert
+ CollectionAssert.AreEqual(surfaceLinesCollection, children);
+ mocks.VerifyAll(); // Expect no calls on tree node
+ }
+
+ [Test]
+ public void CanRenameNode_Always_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var nodeMock = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ // Call
+ var renameAllowed = nodePresenter.CanRenameNode(nodeMock);
+
+ // Assert
+ Assert.IsFalse(renameAllowed);
+ mocks.VerifyAll(); // Expect no calls on tree node
+ }
+
+ [Test]
+ public void CanRenameNodeTo_Always_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var nodeMock = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ // Call
+ var renameAllowed = nodePresenter.CanRenameNodeTo(nodeMock, "");
+
+ // Assert
+ Assert.IsFalse(renameAllowed);
+ mocks.ReplayAll(); // Expect no calls on tree node
+ }
+
+ [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
+ var mocks = new MockRepository();
+ var nodeMock = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var nodePresenter = new PipingSurfaceLineCollectionNodePresenter();
+
+ // Call
+ nodePresenter.OnNodeChecked(nodeMock);
+
+ // Assert
+ mocks.VerifyAll(); // Expect no calls on tree node
+ }
+
+ [Test]
+ public void CanDrag_Always_ReturnNone()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var dataMock = mocks.StrictMock