Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r25d9f184b0a7bf99101d2ec0b1089ba2aeed9080 -r553ac4eda05a343285bc09090a3fb5f80a4d249e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 25d9f184b0a7bf99101d2ec0b1089ba2aeed9080)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -35,8 +35,10 @@
+
+
@@ -53,6 +55,12 @@
+
+ UserControl
+
+
+ AssessmentSectionCommentView.cs
+
UserControl
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.Designer.cs (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -0,0 +1,37 @@
+namespace Ringtoets.Integration.Forms.Views
+{
+ partial class AssessmentSectionCommentView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ }
+
+ #endregion
+ }
+}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -0,0 +1,36 @@
+// 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 System.Windows.Forms;
+using Core.Common.Controls.Views;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ public partial class AssessmentSectionCommentView : UserControl, IView
+ {
+ public AssessmentSectionCommentView()
+ {
+ InitializeComponent();
+ }
+
+ public object Data { get; set; }
+ }
+}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -recec25857ea074a9f85c55050a6e4f8520212a34 -r553ac4eda05a343285bc09090a3fb5f80a4d249e
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision ecec25857ea074a9f85c55050a6e4f8520212a34)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -25,6 +25,7 @@
using System.Drawing;
using System.IO;
using System.Linq;
+using System.Runtime.Remoting.Messaging;
using System.Windows.Forms;
using Core.Common.Base.Data;
using Core.Common.Controls.TreeView;
@@ -94,11 +95,7 @@
{
GetViewName = (v, o) => RingtoetsDataResources.FailureMechanismContribution_DisplayName,
Image = RingtoetsCommonFormsResources.GenericInputOutputIcon,
- CloseForData = (v, o) =>
- {
- var assessmentSection = o as IAssessmentSection;
- return assessmentSection != null && assessmentSection.FailureMechanismContribution == v.Data;
- }
+ CloseForData = CloseFailureMechanismContributionViewForData
};
yield return new ViewInfo
@@ -115,6 +112,13 @@
GetViewData = context => context.SectionResults,
AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism
};
+
+ yield return new ViewInfo
+ {
+ GetViewName = (v, o) => RingtoetsCommonDataResources.AssessmentSectionComment_DisplayName,
+ Image = RingtoetsCommonFormsResources.GenericInputOutputIcon,
+ CloseForData = CloseAssessmentSectionCommentViewForData
+ };
}
///
@@ -237,6 +241,16 @@
};
}
+ #region FailureMechanismContribution ViewInfo
+
+ private static bool CloseFailureMechanismContributionViewForData(FailureMechanismContributionView view, object o)
+ {
+ var assessmentSection = o as IAssessmentSection;
+ return assessmentSection != null && assessmentSection.FailureMechanismContribution == view.Data;
+ }
+
+ #endregion
+
#region FailureMechanismResults ViewInfo
private static bool CloseFailureMechanismResultViewForData(FailureMechanismResultView view, object o)
@@ -252,6 +266,16 @@
#endregion
+ #region AssessmentSectionComment ViewInfo
+
+ private static bool CloseAssessmentSectionCommentViewForData(AssessmentSectionCommentView view, object o)
+ {
+ var assessmentSection = o as IAssessmentSection;
+ return assessmentSection != null && assessmentSection.Comments == view.Data;
+ }
+
+ #endregion
+
#region FailureMechanismSectionsContext
private ContextMenuStrip FailureMechanismSectionsContextMenuStrip(FailureMechanismSectionsContext nodeData, object parentData, TreeViewControl treeViewControl)
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -r6f069737c5a49402fc344e4f7e350c6d869b69f2 -r553ac4eda05a343285bc09090a3fb5f80a4d249e
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 6f069737c5a49402fc344e4f7e350c6d869b69f2)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -68,6 +68,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs
===================================================================
diff -u -rf67372a878749b45946b74d08f75f3da3f673a40 -r553ac4eda05a343285bc09090a3fb5f80a4d249e
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision f67372a878749b45946b74d08f75f3da3f673a40)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -74,7 +74,7 @@
ViewInfo[] viewInfos = guiPlugin.GetViewInfos().ToArray();
// Assert
- Assert.AreEqual(3, viewInfos.Length);
+ Assert.AreEqual(4, viewInfos.Length);
var contributionViewInfo = viewInfos.Single(vi => vi.DataType == typeof(FailureMechanismContribution));
Assert.AreEqual(typeof(FailureMechanismContributionView), contributionViewInfo.ViewType);
@@ -88,6 +88,10 @@
Assert.AreEqual(typeof(IEnumerable), resultViewInfo.ViewDataType);
Assert.AreEqual(typeof(FailureMechanismResultView), resultViewInfo.ViewType);
TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, resultViewInfo.Image);
+
+ var commentView = viewInfos.Single(vi => vi.DataType == typeof(AssessmentSectionComment));
+ Assert.AreEqual(typeof(AssessmentSectionCommentView), commentView.ViewType);
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, commentView.Image);
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionCommentViewInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionCommentViewInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/AssessmentSectionCommentViewInfoTest.cs (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -0,0 +1,123 @@
+using System.Linq;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data;
+using Ringtoets.Integration.Forms.Views;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class AssessmentSectionCommentViewInfoTest
+ {
+ private MockRepository mocks;
+ private RingtoetsGuiPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new RingtoetsGuiPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(AssessmentSectionCommentView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(AssessmentSectionComment), info.DataType);
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Setup
+ var comment = new AssessmentSectionComment();
+ var viewMock = mocks.StrictMock();
+
+ mocks.ReplayAll();
+
+ // Call
+ var viewName = info.GetViewName(viewMock, comment);
+
+ // Assert
+ Assert.AreEqual("Opmerkingen", viewName);
+ }
+
+ [Test]
+ public void ViewType_Always_ReturnsViewType()
+ {
+ // Call
+ var viewType = info.ViewType;
+
+ // Assert
+ Assert.AreEqual(typeof(AssessmentSectionCommentView), viewType);
+ }
+
+ [Test]
+ public void DataType_Always_ReturnsDataType()
+ {
+ // Call
+ var dataType = info.DataType;
+
+ // Assert
+ Assert.AreEqual(typeof(AssessmentSectionComment), dataType);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsGenericInputOutputIcon()
+ {
+ // Call
+ var image = info.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GenericInputOutputIcon, image);
+ }
+
+ [Test]
+ public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var viewMock = mocks.StrictMock();
+ var assessmentSectionMock = mocks.Stub();
+
+ viewMock.Expect(vm => vm.Data).Return(assessmentSectionMock.Comments);
+
+ mocks.ReplayAll();
+
+ // Call
+ var closeForData = info.CloseForData(viewMock, assessmentSectionMock);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ [Test]
+ public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var viewMock = mocks.StrictMock();
+ var assessmentSectionMock = mocks.Stub();
+ var assessmentSectionMock2 = mocks.Stub();
+
+ viewMock.Expect(vm => vm.Data).Return(assessmentSectionMock2.Comments);
+
+ mocks.ReplayAll();
+
+ // Call
+ var closeForData = info.CloseForData(viewMock, assessmentSectionMock);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ }
+}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs
===================================================================
diff -u -r3434a272cc8bfb25dae4bd7bd50afedb377343c0 -r553ac4eda05a343285bc09090a3fb5f80a4d249e
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs (.../FailureMechanismResultViewInfoTest.cs) (revision 3434a272cc8bfb25dae4bd7bd50afedb377343c0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismResultViewInfoTest.cs (.../FailureMechanismResultViewInfoTest.cs) (revision 553ac4eda05a343285bc09090a3fb5f80a4d249e)
@@ -88,7 +88,7 @@
// Call
var viewName = info.GetViewName(viewMock, failureMechanism.SectionResults);
- //
+ // Assert
Assert.AreEqual("Oordeel", viewName);
}