Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.Designer.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.Designer.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.Designer.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,122 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+
+namespace Ringtoets.Common.Forms.Controls
+{
+#if DEVELOPMENT
+ partial class AssemblyResultControl
+#else
+ abstract partial class AssemblyResultControl
+#endif
+
+ {
+ ///
+ /// 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()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.GroupPanel = new System.Windows.Forms.TableLayoutPanel();
+ this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+ this.GroupLabel = new Ringtoets.Common.Forms.Controls.BorderedLabel();
+ this.GroupPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit();
+ this.SuspendLayout();
+ //
+ // GroupPanel
+ //
+ this.GroupPanel.AutoSize = true;
+ this.GroupPanel.ColumnCount = 1;
+ this.GroupPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.GroupPanel.Controls.Add(this.GroupLabel, 0, 0);
+ this.GroupPanel.Dock = System.Windows.Forms.DockStyle.Left;
+ this.GroupPanel.Location = new System.Drawing.Point(0, 0);
+ this.GroupPanel.Name = "GroupPanel";
+ this.GroupPanel.RowCount = 1;
+ this.GroupPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.GroupPanel.Size = new System.Drawing.Size(56, 150);
+ this.GroupPanel.TabIndex = 0;
+ //
+ // ErrorProvider
+ //
+ this.ErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
+ this.ErrorProvider.ContainerControl = this;
+ this.ErrorProvider.Icon = global::Ringtoets.Common.Forms.Properties.Resources.ErrorIcon;
+ //
+ // GroupLabel
+ //
+ this.GroupLabel.AutoSize = true;
+ this.GroupLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.GroupLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.GroupLabel.Location = new System.Drawing.Point(3, 3);
+ this.GroupLabel.Margin = new System.Windows.Forms.Padding(3);
+ this.GroupLabel.MinimumSize = new System.Drawing.Size(50, 0);
+ this.GroupLabel.Name = "GroupLabel";
+ this.GroupLabel.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
+ this.GroupLabel.Size = new System.Drawing.Size(50, 144);
+ this.GroupLabel.TabIndex = 1;
+ this.GroupLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // AssemblyResultControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.Controls.Add(this.GroupPanel);
+ this.Name = "AssemblyResultControl";
+ this.Size = new System.Drawing.Size(274, 150);
+ this.GroupPanel.ResumeLayout(false);
+ this.GroupPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ protected System.Windows.Forms.TableLayoutPanel GroupPanel;
+ protected System.Windows.Forms.ErrorProvider ErrorProvider;
+ protected BorderedLabel GroupLabel;
+ }
+}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,68 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Ringtoets.Common.Forms.Controls
+{
+ ///
+ /// Custom base control to display an assembly result.
+ ///
+ public abstract partial class AssemblyResultControl : UserControl
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ protected AssemblyResultControl()
+ {
+ InitializeComponent();
+ Dock = DockStyle.Left;
+ }
+
+ ///
+ /// Clears the error message of the control.
+ ///
+ public void ClearError()
+ {
+ ErrorProvider.SetError(this, string.Empty);
+ }
+
+ ///
+ /// Sets the error message of the control and clears its values.
+ ///
+ /// The error message to set.
+ /// Thrown when
+ /// is null.
+ public virtual void SetError(string error)
+ {
+ if (error == null)
+ {
+ throw new ArgumentNullException(nameof(error));
+ }
+
+ ErrorProvider.SetError(this, error);
+ GroupLabel.Text = string.Empty;
+ GroupLabel.BackColor = Color.White;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.resx
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.resx (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/AssemblyResultControl.resx (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyCategoryGroupControl.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyCategoryGroupControl.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyCategoryGroupControl.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,43 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Util;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Helpers;
+
+namespace Ringtoets.Common.Forms.Controls
+{
+ ///
+ /// Custom control to display a .
+ ///
+ public class FailureMechanismAssemblyCategoryGroupControl : AssemblyResultControl
+ {
+ ///
+ /// Set the value of to the control.
+ ///
+ /// The to set on the control.
+ public void SetAssemblyResult(FailureMechanismAssemblyCategoryGroup category)
+ {
+ GroupLabel.Text = new EnumDisplayWrapper(category).DisplayName;
+ GroupLabel.BackColor = AssemblyCategoryGroupColorHelper.GetFailureMechanismAssemblyCategoryGroupColor(category);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.Designer.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.Designer.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.Designer.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,106 @@
+// Copyright (C) Stichting Deltares 2017. 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.
+
+namespace Ringtoets.Common.Forms.Controls
+{
+ partial class FailureMechanismAssemblyControl
+ {
+ ///
+ /// 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()
+ {
+ this.probabilityPanel = new System.Windows.Forms.TableLayoutPanel();
+ this.probabilityLabel = new Ringtoets.Common.Forms.Controls.BorderedLabel();
+ ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit();
+ this.probabilityPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // probabilityPanel
+ //
+ this.probabilityPanel.ColumnCount = 1;
+ this.probabilityPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.probabilityPanel.Controls.Add(this.probabilityLabel, 0, 0);
+ this.probabilityPanel.Dock = System.Windows.Forms.DockStyle.Left;
+ this.probabilityPanel.Location = new System.Drawing.Point(56, 0);
+ this.probabilityPanel.Name = "probabilityPanel";
+ this.probabilityPanel.RowCount = 1;
+ this.probabilityPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.probabilityPanel.Size = new System.Drawing.Size(200, 796);
+ this.probabilityPanel.TabIndex = 1;
+ //
+ // probabilityLabel
+ //
+ this.probabilityLabel.AutoSize = true;
+ this.probabilityLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.probabilityLabel.Dock = System.Windows.Forms.DockStyle.Left;
+ this.probabilityLabel.Location = new System.Drawing.Point(3, 3);
+ this.probabilityLabel.Margin = new System.Windows.Forms.Padding(3);
+ this.probabilityLabel.MinimumSize = new System.Drawing.Size(50, 2);
+ this.probabilityLabel.Name = "probabilityLabel";
+ this.probabilityLabel.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
+ this.probabilityLabel.Size = new System.Drawing.Size(50, 790);
+ this.probabilityLabel.TabIndex = 0;
+ this.probabilityLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // FailureMechanismAssemblyControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.probabilityPanel);
+ this.Name = "FailureMechanismAssemblyControl";
+ this.Size = new System.Drawing.Size(256, 796);
+ this.Controls.SetChildIndex(this.probabilityPanel, 0);
+ ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit();
+ this.probabilityPanel.ResumeLayout(false);
+ this.probabilityPanel.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TableLayoutPanel probabilityPanel;
+ private BorderedLabel probabilityLabel;
+ }
+}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,65 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+using Core.Common.Util;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.Controls
+{
+ ///
+ /// Custom control to display a .
+ ///
+ public partial class FailureMechanismAssemblyControl : AssemblyResultControl
+ {
+ public FailureMechanismAssemblyControl()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// Set the values of to the control.
+ ///
+ /// The to set on the control.
+ /// Thrown when is null.
+ public void SetAssemblyResult(FailureMechanismAssembly assembly)
+ {
+ if (assembly == null)
+ {
+ throw new ArgumentNullException(nameof(assembly));
+ }
+
+ GroupLabel.Text = new EnumDisplayWrapper(assembly.Group).DisplayName;
+ GroupLabel.BackColor = AssemblyCategoryGroupColorHelper.GetFailureMechanismAssemblyCategoryGroupColor(assembly.Group);
+
+ probabilityLabel.Text = new NoProbabilityValueDoubleConverter().ConvertToString(assembly.Probability);
+ }
+
+ public override void SetError(string error)
+ {
+ base.SetError(error);
+ probabilityLabel.Text = Resources.RoundedDouble_No_result_dash;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.resx
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.resx (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyControl.resx (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultControl.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultControl.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultControl.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultWithProbabilityControl.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultWithProbabilityControl.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Controls/FailureMechanismAssemblyResultWithProbabilityControl.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/AssemblyResultControlTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/AssemblyResultControlTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/AssemblyResultControlTest.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,120 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+using System.Drawing;
+using System.Windows.Forms;
+using Core.Common.TestUtil;
+using Core.Common.Util.Reflection;
+using NUnit.Framework;
+using Ringtoets.Common.Forms.Controls;
+using Ringtoets.Common.Forms.Properties;
+
+namespace Ringtoets.Common.Forms.Test.Controls
+{
+ [TestFixture]
+ public class AssemblyResultControlTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var resultControl = new TestAssemblyResultControl();
+
+ // Assert
+ Assert.AreEqual(1, resultControl.Controls.Count);
+ Assert.IsInstanceOf(resultControl);
+ Assert.IsTrue(resultControl.AutoSize);
+ Assert.AreEqual(DockStyle.Left, resultControl.Dock);
+
+ TableLayoutPanel groupPanel = GetGroupPanel(resultControl);
+ Assert.AreEqual(1, groupPanel.ColumnCount);
+ Assert.AreEqual(1, groupPanel.RowCount);
+
+ var groupLabel = (BorderedLabel) groupPanel.GetControlFromPosition(0, 0);
+ Assert.IsTrue(groupLabel.AutoSize);
+ Assert.AreEqual(DockStyle.Fill, groupLabel.Dock);
+ Assert.AreEqual(new Padding(5, 0, 5, 0), groupLabel.Padding);
+
+ var errorProvider = TypeUtils.GetField(resultControl, "ErrorProvider");
+ TestHelper.AssertImagesAreEqual(Resources.ErrorIcon.ToBitmap(), errorProvider.Icon.ToBitmap());
+ }
+
+ [Test]
+ public void SetError_ErrorNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var resultControl = new TestAssemblyResultControl();
+
+ // Call
+ TestDelegate test = () => resultControl.SetError(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("error", exception.ParamName);
+ }
+
+ [Test]
+ public void SetError_WithError_SetsErrorOnControl()
+ {
+ // Setup
+ const string error = "random error 123";
+ var resultControl = new TestAssemblyResultControl();
+
+ // Call
+ resultControl.SetError(error);
+
+ // Assert
+ ErrorProvider errorProvider = GetErrorProvider(resultControl);
+ Assert.AreEqual(error, errorProvider.GetError(resultControl));
+
+ Control groupLabel = GetGroupPanel(resultControl).GetControlFromPosition(0, 0);
+ Assert.IsEmpty(groupLabel.Text);
+ Assert.AreEqual(Color.White, groupLabel.BackColor);
+ }
+
+ [Test]
+ public void ClearError_Always_ClearsErrorOnControl()
+ {
+ // Setup
+ var resultControl = new TestAssemblyResultControl();
+
+ // Call
+ resultControl.ClearError();
+
+ // Assert
+ ErrorProvider errorProvider = GetErrorProvider(resultControl);
+ Assert.AreEqual(string.Empty, errorProvider.GetError(resultControl));
+ }
+
+ private static ErrorProvider GetErrorProvider(AssemblyResultControl resultControl)
+ {
+ return TypeUtils.GetField(resultControl, "ErrorProvider");
+ }
+
+ private static TableLayoutPanel GetGroupPanel(AssemblyResultControl resultControl)
+ {
+ return TypeUtils.GetField(resultControl, "GroupPanel");
+ }
+
+ private class TestAssemblyResultControl : AssemblyResultControl {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyCategoryGroupControlTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyCategoryGroupControlTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyCategoryGroupControlTest.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,73 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+using System.Windows.Forms;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using Core.Common.Util.Reflection;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Controls;
+using Ringtoets.Common.Forms.Helpers;
+
+namespace Ringtoets.Common.Forms.Test.Controls
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyCategoryGroupControlTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var resultControl = new FailureMechanismAssemblyCategoryGroupControl();
+
+ // Assert
+ Assert.AreEqual(1, resultControl.Controls.Count);
+ Assert.IsInstanceOf(resultControl);
+ }
+
+ [Test]
+ public void SetAssemblyResult_WithCategory_SetsValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var assembly = random.NextEnumValue();
+ var resultControl = new FailureMechanismAssemblyCategoryGroupControl();
+
+ // Call
+ resultControl.SetAssemblyResult(assembly);
+
+ // Assert
+ Control groupLabel = GetGroupPanel(resultControl).GetControlFromPosition(0, 0);
+
+ Assert.AreEqual(new EnumDisplayWrapper(assembly).DisplayName,
+ groupLabel.Text);
+ Assert.AreEqual(AssemblyCategoryGroupColorHelper.GetFailureMechanismAssemblyCategoryGroupColor(assembly),
+ groupLabel.BackColor);
+ }
+
+ private static TableLayoutPanel GetGroupPanel(FailureMechanismAssemblyCategoryGroupControl resultControl)
+ {
+ return TypeUtils.GetField(resultControl, "GroupPanel");
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyControlTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyControlTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyControlTest.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,158 @@
+// Copyright (C) Stichting Deltares 2017. 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;
+using System.Drawing;
+using System.Windows.Forms;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using Core.Common.Util.Reflection;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Controls;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Common.Forms.Test.Controls
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyControlTest
+ {
+ [Test]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var resultControl = new FailureMechanismAssemblyControl();
+
+ // Assert
+ Assert.AreEqual(2, resultControl.Controls.Count);
+ Assert.IsInstanceOf(resultControl);
+ Assert.IsTrue(resultControl.AutoSize);
+ Assert.AreEqual(DockStyle.Left, resultControl.Dock);
+
+ TableLayoutPanel groupPanel = GetGroupPanel(resultControl);
+ Assert.AreEqual(1, groupPanel.ColumnCount);
+ Assert.AreEqual(1, groupPanel.RowCount);
+
+ var groupLabel = (BorderedLabel) groupPanel.GetControlFromPosition(0, 0);
+ Assert.IsTrue(groupLabel.AutoSize);
+ Assert.AreEqual(DockStyle.Fill, groupLabel.Dock);
+ Assert.AreEqual(new Padding(5, 0, 5, 0), groupLabel.Padding);
+
+ var errorProvider = TypeUtils.GetField(resultControl, "ErrorProvider");
+ TestHelper.AssertImagesAreEqual(Resources.ErrorIcon.ToBitmap(), errorProvider.Icon.ToBitmap());
+
+ TableLayoutPanel probabilityPanel = GetProbabilityPanel(resultControl);
+ Assert.AreEqual(1, probabilityPanel.ColumnCount);
+ Assert.AreEqual(1, probabilityPanel.RowCount);
+
+ var probabilityLabel = (BorderedLabel) probabilityPanel.GetControlFromPosition(0, 0);
+ Assert.IsTrue(probabilityLabel.AutoSize);
+ Assert.AreEqual(DockStyle.Left, probabilityLabel.Dock);
+ Assert.AreEqual(new Padding(5, 0, 5, 0), probabilityLabel.Padding);
+ }
+
+ [Test]
+ public void SetAssemblyResult_AssemblyNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var resultControl = new FailureMechanismAssemblyControl();
+
+ // Call
+ TestDelegate test = () => resultControl.SetAssemblyResult(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assembly", exception.ParamName);
+ }
+
+ [Test]
+ public void SetAssemblyResult_WithAssembly_SetsValuesOnControl()
+ {
+ // Setup
+ var random = new Random(39);
+ var assembly = new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue());
+ var resultControl = new FailureMechanismAssemblyControl();
+
+ // Call
+ resultControl.SetAssemblyResult(assembly);
+
+ // Assert
+ Control groupLabel = GetGroupPanel(resultControl).GetControlFromPosition(0, 0);
+ Control probabilityLabel = GetProbabilityPanel(resultControl).GetControlFromPosition(0, 0);
+
+ Assert.AreEqual(new EnumDisplayWrapper(assembly.Group).DisplayName,
+ groupLabel.Text);
+ Assert.AreEqual(AssemblyCategoryGroupColorHelper.GetFailureMechanismAssemblyCategoryGroupColor(assembly.Group),
+ groupLabel.BackColor);
+
+ Assert.AreEqual(new NoProbabilityValueDoubleConverter().ConvertToString(assembly.Probability),
+ probabilityLabel.Text);
+ }
+
+ [Test]
+ public void SetError_ErrorNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var resultControl = new FailureMechanismAssemblyControl();
+
+ // Call
+ TestDelegate test = () => resultControl.SetError(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("error", exception.ParamName);
+ }
+
+ [Test]
+ public void SetError_WithError_SetsErrorOnControl()
+ {
+ // Setup
+ const string error = "random error 123";
+ var resultControl = new FailureMechanismAssemblyControl();
+
+ // Call
+ resultControl.SetError(error);
+
+ // Assert
+ var errorProvider = TypeUtils.GetField(resultControl, "ErrorProvider");
+ Assert.AreEqual(error, errorProvider.GetError(resultControl));
+
+ Control groupLabel = GetGroupPanel(resultControl).GetControlFromPosition(0, 0);
+ Control probabilityLabel = GetProbabilityPanel(resultControl).GetControlFromPosition(0, 0);
+ Assert.IsEmpty(groupLabel.Text);
+ Assert.AreEqual(Color.White, groupLabel.BackColor);
+ Assert.AreEqual("-", probabilityLabel.Text);
+ }
+
+ private static TableLayoutPanel GetProbabilityPanel(FailureMechanismAssemblyControl resultControl)
+ {
+ return TypeUtils.GetField(resultControl, "probabilityPanel");
+ }
+
+ private static TableLayoutPanel GetGroupPanel(FailureMechanismAssemblyControl resultControl)
+ {
+ return TypeUtils.GetField(resultControl, "GroupPanel");
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyResultControlTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Controls/FailureMechanismAssemblyResultWithProbabilityControlTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTester.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTester.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/FailureMechanismAssemblyCategoryGroupControlTester.cs (revision 96e729865d3978156ee7d869c1f45f51dae51bcd)
@@ -0,0 +1,128 @@
+// Copyright (C) Stichting Deltares 2017. 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.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.Controls;
+using Ringtoets.Common.Forms.Views;
+
+namespace Ringtoets.Common.Forms.TestUtil
+{
+ ///
+ /// Class for testing data and styling in a view with a .
+ ///
+ /// The type of the view to test.
+ /// The type of the failure mechanism the view belongs to.
+ /// The type of the section results shown in the view.
+ /// The type of the presentation objects used in the view.
+ public abstract class FailureMechanismAssemblyCategoryGroupControlTester
+ where TView : FailureMechanismResultView
+ where TFailureMechanism : IFailureMechanism, IHasSectionResults, new()
+ where TSectionResult : FailureMechanismSectionResult
+ where TResultRow : FailureMechanismSectionResultRow
+ {
+ private Form testForm;
+
+ [SetUp]
+ public void Setup()
+ {
+ testForm = new Form();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ testForm.Dispose();
+ }
+
+ [Test]
+ public void FailureMechanismResultsView_Always_FailureMechanismResultControlCorrectlyInitialized()
+ {
+ // Setup
+ var failureMechanism = new TFailureMechanism();
+ failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ // Call
+ using (new AssemblyToolCalculatorFactoryConfig())
+ using (ShowFailureMechanismResultsView(failureMechanism))
+ {
+ // Assert
+ var assemblyResultPanel = (TableLayoutPanel) new ControlTester("TableLayoutPanel").TheObject;
+ var assemblyResultControl = (FailureMechanismAssemblyCategoryGroupControl) assemblyResultPanel.GetControlFromPosition(0, 0);
+
+ Assert.IsInstanceOf(assemblyResultControl);
+ Assert.AreEqual(DockStyle.Left, assemblyResultControl.Dock);
+ }
+ }
+
+ [Test]
+ public void GivenFailureMechanismResultsView_WhenResultChangedAndSectionResultNotified_FailureMechanismAssemblyResultUpdated()
+ {
+ // Given
+ var failureMechanism = new TFailureMechanism();
+ failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ using (ShowFailureMechanismResultsView(failureMechanism))
+ {
+ // Precondition
+ var assemblyGroupLabel = (BorderedLabel) new ControlTester("GroupLabel").TheObject;
+ Assert.AreEqual("IIt", assemblyGroupLabel.Text);
+ Assert.AreEqual(Color.FromArgb(118, 147, 60), assemblyGroupLabel.BackColor);
+
+ // When
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismAssemblyCalculator;
+ calculator.FailureMechanismAssemblyCategoryGroupOutput = FailureMechanismAssemblyCategoryGroup.VIt;
+ failureMechanism.SectionResults.Single().NotifyObservers();
+
+ // Assert
+ Assert.AreEqual("VIt", assemblyGroupLabel.Text);
+ Assert.AreEqual(Color.FromArgb(255, 0, 0), assemblyGroupLabel.BackColor);
+ }
+ }
+
+ ///
+ /// Method for creating an instance of .
+ ///
+ /// The failure mechanism to create the view for.
+ /// A new .
+ protected abstract TView CreateResultView(TFailureMechanism failureMechanism);
+
+ private TView ShowFailureMechanismResultsView(TFailureMechanism failureMechanism)
+ {
+ TView failureMechanismResultView = CreateResultView(failureMechanism);
+ testForm.Controls.Add(failureMechanismResultView);
+ testForm.Show();
+
+ return failureMechanismResultView;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 96e729865d3978156ee7d869c1f45f51dae51bcd refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/FailureMechanismAssemblyResultControlTester.cs'.
Fisheye: No comparison available. Pass `N' to diff?