Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -92,6 +92,42 @@
}
///
+ /// Looks up a localized string similar to Kleur.
+ ///
+ public static string AssemblyCategory_Color_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyCategory_Color_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Categorie.
+ ///
+ public static string AssemblyCategory_Group_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyCategory_Group_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Ondergrens [1/jaar].
+ ///
+ public static string AssemblyCategory_LowerBoundary_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyCategory_LowerBoundary_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Bovengrens [1/jaar].
+ ///
+ public static string AssemblyCategory_UpperBoundary_DisplayName {
+ get {
+ return ResourceManager.GetString("AssemblyCategory_UpperBoundary_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Waterstand met een overschrijdingsfrequentie gelijk aan de trajectnorm..
///
public static string AssessmentLevel_Description {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -1419,4 +1419,16 @@
Bovengrens [1/jaar]
+
+ Kleur
+
+
+ Categorie
+
+
+ Ondergrens [1/jaar]
+
+
+ Bovengrens [1/jaar]
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -101,15 +101,6 @@
}
///
- /// Looks up a localized string similar to Categorie.
- ///
- public static string AssemblyCategory_Group_DisplayName {
- get {
- return ResourceManager.GetString("AssemblyCategory_Group_DisplayName", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Assemblage.
///
public static string AssemblyResultCategoryTreeFolder_DisplayName {
@@ -237,33 +228,6 @@
}
///
- /// Looks up a localized string similar to Kleur.
- ///
- public static string AssessmentSectionAssemblyCategory_Color_DisplayName {
- get {
- return ResourceManager.GetString("AssessmentSectionAssemblyCategory_Color_DisplayName", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Ondergrens [1/jaar].
- ///
- public static string AssessmentSectionAssemblyCategory_LowerBoundary_DisplayName {
- get {
- return ResourceManager.GetString("AssessmentSectionAssemblyCategory_LowerBoundary_DisplayName", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Bovengrens [1/jaar].
- ///
- public static string AssessmentSectionAssemblyCategory_UpperBoundary_DisplayName {
- get {
- return ResourceManager.GetString("AssessmentSectionAssemblyCategory_UpperBoundary_DisplayName", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Selecteer het type traject, bepalend voor de faalkansbegroting..
///
public static string AssessmentSectionComposition_Composition_Description {
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -339,18 +339,6 @@
Overig ({0})
-
- Kleur
-
-
- Categorie
-
-
- Ondergrens [1/jaar]
-
-
- Bovengrens [1/jaar]
-
Assemblage
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -109,8 +109,8 @@
DesignWaterLevelCalculationsView.cs
-
-
+
+
UserControl
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoriesTable.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoriesTable.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoriesTable.cs (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -0,0 +1,75 @@
+// 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.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using Core.Common.Controls.DataGrid;
+using Ringtoets.AssemblyTool.Data;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// This class defines a table in which properties of instances
+ /// are shown as rows.
+ ///
+ public class AssemblyCategoriesTable : DataGridViewControl
+ where T : struct
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public AssemblyCategoriesTable()
+ {
+ AddColumns();
+ }
+
+ ///
+ /// Sets the given for which the properties
+ /// are shown in the table.
+ ///
+ /// The collection of categories to show.
+ public void SetData(IEnumerable> categories)
+ {
+ SetDataSource(categories?.Select(category => new AssemblyCategoryRow(category.Item1, category.Item2, category.Item3)).ToArray());
+ }
+
+ private void AddColumns()
+ {
+ AddTextBoxColumn(nameof(AssemblyCategoryRow.Group),
+ RingtoetsCommonFormsResources.AssemblyCategory_Group_DisplayName,
+ true);
+
+ AddColorColumn(nameof(AssemblyCategoryRow.Color),
+ RingtoetsCommonFormsResources.AssemblyCategory_Color_DisplayName);
+
+ AddTextBoxColumn(nameof(AssemblyCategoryRow.LowerBoundary),
+ RingtoetsCommonFormsResources.AssemblyCategory_LowerBoundary_DisplayName,
+ true);
+
+ AddTextBoxColumn(nameof(AssemblyCategoryRow.UpperBoundary),
+ RingtoetsCommonFormsResources.AssemblyCategory_UpperBoundary_DisplayName,
+ true);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoryRow.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoryRow.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyCategoryRow.cs (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -0,0 +1,83 @@
+// 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.ComponentModel;
+using System.Drawing;
+using Core.Common.Util;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.TypeConverters;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// This class represents a row displaying the properties of a .
+ ///
+ internal class AssemblyCategoryRow
+ where T : struct
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The to use.
+ /// The belonging to this category.
+ /// The category group of this category.
+ /// Thrown when
+ /// is null.
+ public AssemblyCategoryRow(AssemblyCategory assemblyCategory,
+ Color assemblyColor,
+ T assemblyCategoryGroup)
+ {
+ if (assemblyCategory == null)
+ {
+ throw new ArgumentNullException(nameof(assemblyCategory));
+ }
+
+ Group = assemblyCategoryGroup;
+ Color = assemblyColor;
+ UpperBoundary = assemblyCategory.UpperBoundary;
+ LowerBoundary = assemblyCategory.LowerBoundary;
+ }
+
+ ///
+ /// Gets the display name of the category group.
+ ///
+ [TypeConverter(typeof(EnumTypeConverter))]
+ public T Group { get; }
+
+ ///
+ /// Gets the color of the category.
+ ///
+ public Color Color { get; }
+
+ ///
+ /// Gets the lower boundary of the category.
+ ///
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double LowerBoundary { get; }
+
+ ///
+ /// Gets the upper boundary of the category.
+ ///
+ [TypeConverter(typeof(NoProbabilityValueDoubleConverter))]
+ public double UpperBoundary { get; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs
===================================================================
diff -u -rc704dafc81a213131e51f78b19fee63c14a9a5a5 -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision c704dafc81a213131e51f78b19fee63c14a9a5a5)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -134,7 +134,7 @@
true);
dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRowBase.CategoryGroup),
- Resources.AssemblyCategory_Group_DisplayName,
+ RingtoetsCommonFormsResources.AssemblyCategory_Group_DisplayName,
true);
dataGridViewControl.AddTextBoxColumn(nameof(FailureMechanismAssemblyResultRowBase.Probablity),
Fisheye: Tag 0d4d9548637cbf814359cece7b551ca85b8378c3 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesTable.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs
===================================================================
diff -u -r2a88a8c275a4e795e771affc75aa31f475d97079 -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs (.../AssessmentSectionAssemblyCategoriesView.Designer.cs) (revision 2a88a8c275a4e795e771affc75aa31f475d97079)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs (.../AssessmentSectionAssemblyCategoriesView.Designer.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -19,6 +19,8 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using Ringtoets.AssemblyTool.Data;
+
namespace Ringtoets.Integration.Forms.Views
{
partial class AssessmentSectionAssemblyCategoriesView
@@ -38,19 +40,19 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssessmentSectionAssemblyCategoriesView));
- this.assessmentSectionAssemblyCategoriesTable = new Ringtoets.Integration.Forms.Views.AssessmentSectionAssemblyCategoriesTable();
+ this.assemblyCategoriesTable = new Ringtoets.Integration.Forms.Views.AssemblyCategoriesTable();
this.SuspendLayout();
//
// assessmentSectionAssemblyCategoriesTable
//
- resources.ApplyResources(this.assessmentSectionAssemblyCategoriesTable, "assessmentSectionAssemblyCategoriesTable");
- this.assessmentSectionAssemblyCategoriesTable.MultiSelect = true;
- this.assessmentSectionAssemblyCategoriesTable.Name = "assessmentSectionAssemblyCategoriesTable";
- this.assessmentSectionAssemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
+ resources.ApplyResources(this.assemblyCategoriesTable, "assemblyCategoriesTable");
+ this.assemblyCategoriesTable.MultiSelect = true;
+ this.assemblyCategoriesTable.Name = "assemblyCategoriesTable";
+ this.assemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
//
// FailureMechanismSectionsView
//
- this.Controls.Add(this.assessmentSectionAssemblyCategoriesTable);
+ this.Controls.Add(this.assemblyCategoriesTable);
this.Name = "AssessmentSectionAssemblyCategoriesView";
resources.ApplyResources(this, "$this");
this.ResumeLayout(false);
@@ -60,6 +62,6 @@
#endregion
- private AssessmentSectionAssemblyCategoriesTable assessmentSectionAssemblyCategoriesTable;
+ private AssemblyCategoriesTable assemblyCategoriesTable;
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs
===================================================================
diff -u -rf147b624dadd780d3186ec19c301d9ed1634504e -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (.../AssessmentSectionAssemblyCategoriesView.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (.../AssessmentSectionAssemblyCategoriesView.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -20,12 +20,15 @@
// All rights reserved.
using System;
+using System.Drawing;
+using System.Linq;
using System.Windows.Forms;
using Core.Common.Base;
using Core.Common.Controls.Views;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Data.AssemblyTool;
using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Forms.Helpers;
namespace Ringtoets.Integration.Forms.Views
{
@@ -68,7 +71,7 @@
public FailureMechanismContribution FailureMechanismContribution { get; }
public object Data { get; set; }
-
+
protected override void Dispose(bool disposing)
{
failureMechanismContributionObserver.Dispose();
@@ -83,9 +86,14 @@
private void UpdateTableData()
{
- assessmentSectionAssemblyCategoriesTable.SetData(AssemblyToolCategoriesFactory.CreateAssessmentSectionAssemblyCategories(
- FailureMechanismContribution.SignalingNorm,
- FailureMechanismContribution.LowerLimitNorm));
+ assemblyCategoriesTable.SetData(
+ AssemblyToolCategoriesFactory.CreateAssessmentSectionAssemblyCategories(
+ FailureMechanismContribution.SignalingNorm,
+ FailureMechanismContribution.LowerLimitNorm)
+ .Select(category => new Tuple(
+ category,
+ AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(category.Group),
+ category.Group)));
}
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx
===================================================================
diff -u -r4d5f18805638d24f450406e9eda206b2f3591c36 -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx (.../AssessmentSectionAssemblyCategoriesView.resx) (revision 4d5f18805638d24f450406e9eda206b2f3591c36)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx (.../AssessmentSectionAssemblyCategoriesView.resx) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -118,30 +118,30 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
Fill
-
+
0, 0
-
+
750, 420
-
+
0
-
- assessmentSectionAssemblyCategoriesTable
+
+ assemblyCategoriesTable
-
+
Ringtoets.Integration.Forms.Views.AssessmentSectionAssemblyCategoriesTable, Ringtoets.Common.Forms, Version=18.1.1.1, Culture=neutral, PublicKeyToken=null
-
+
$this
-
+
0
Fisheye: Tag 0d4d9548637cbf814359cece7b551ca85b8378c3 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoryRow.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -70,9 +70,9 @@
-
+
-
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoriesTableTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoriesTableTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoriesTableTest.cs (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -0,0 +1,192 @@
+// 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.Controls.DataGrid;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class AssemblyCategoriesTableTest
+ {
+ private const int categoryGroupColumnIndex = 0;
+ private const int colorColumnIndex = 1;
+ private const int lowerBoundaryColumnIndex = 2;
+ private const int upperBoundaryColumnIndex = 3;
+
+ [Test]
+ public void Constructor_InitializesWithColumns()
+ {
+ // Call
+ using (var table = new AssemblyCategoriesTable())
+ {
+ // Assert
+ Assert.IsInstanceOf(table);
+
+ DataGridViewColumn groupColumn = table.GetColumnFromIndex(categoryGroupColumnIndex);
+ Assert.AreEqual("Categorie", groupColumn.HeaderText);
+ Assert.IsTrue(groupColumn.ReadOnly);
+ Assert.IsInstanceOf(groupColumn);
+
+ DataGridViewColumn colorColumn = table.GetColumnFromIndex(colorColumnIndex);
+ Assert.AreEqual("Kleur", colorColumn.HeaderText);
+ Assert.IsTrue(colorColumn.ReadOnly);
+ Assert.IsInstanceOf(colorColumn);
+
+ DataGridViewColumn lowerBoundaryColumn = table.GetColumnFromIndex(lowerBoundaryColumnIndex);
+ Assert.AreEqual("Ondergrens [1/jaar]", lowerBoundaryColumn.HeaderText);
+ Assert.IsTrue(lowerBoundaryColumn.ReadOnly);
+ Assert.IsInstanceOf(lowerBoundaryColumn);
+
+ DataGridViewColumn upperBoundaryColumn = table.GetColumnFromIndex(upperBoundaryColumnIndex);
+ Assert.AreEqual("Bovengrens [1/jaar]", upperBoundaryColumn.HeaderText);
+ Assert.IsTrue(upperBoundaryColumn.ReadOnly);
+ Assert.IsInstanceOf(upperBoundaryColumn);
+
+ Assert.Throws(() => table.GetColumnFromIndex(upperBoundaryColumnIndex + 1));
+
+ CollectionAssert.IsEmpty(table.Rows);
+ }
+ }
+
+ [Test]
+ public void SetData_NoDataAlreadySet_SetNewData()
+ {
+ // Setup
+ using (var table = new AssemblyCategoriesTable())
+ {
+ Tuple[] categories =
+ {
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory()
+ };
+
+ // Call
+ table.SetData(categories);
+
+ // Assert
+ Assert.AreEqual(categories.Length, table.Rows.Count);
+ }
+ }
+
+ [Test]
+ public void SetData_SetNullDataAfterDataAlreadySet_ClearsData()
+ {
+ // Setup
+ using (var table = new AssemblyCategoriesTable())
+ {
+ Tuple[] categories =
+ {
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory()
+ };
+ table.SetData(categories);
+
+ // Call
+ table.SetData(null);
+
+ // Assert
+ Assert.AreEqual(0, table.Rows.Count);
+ }
+ }
+
+ [Test]
+ public void SetData_SetNewDataAfterDataAlreadySet_ClearDataAndAddNewData()
+ {
+ // Setup
+ using (var table = new AssemblyCategoriesTable())
+ {
+ table.SetData(new[]
+ {
+ CreateAssessmentSectionAssemblyCategory()
+ });
+
+ Tuple[] newCategories =
+ {
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory()
+ };
+
+ // Call
+ table.SetData(newCategories);
+
+ // Assert
+ Assert.AreEqual(newCategories.Length, table.Rows.Count);
+ }
+ }
+
+ [Test]
+ public void SetData_WithData_ExpectedValuesInTable()
+ {
+ // Setup
+ using (var table = new AssemblyCategoriesTable())
+ {
+ Tuple[] categories =
+ {
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory(),
+ CreateAssessmentSectionAssemblyCategory()
+ };
+
+ // Call
+ table.SetData(categories);
+
+ // Assert
+ Assert.AreEqual(categories.Length, table.Rows.Count);
+ for (var i = 0; i < table.Rows.Count; i++)
+ {
+ Tuple category = categories[i];
+ DataGridViewCellCollection rowCells = table.Rows[i].Cells;
+
+ Assert.AreEqual(category.Item3, rowCells[categoryGroupColumnIndex].Value);
+ Assert.AreEqual(category.Item2, rowCells[colorColumnIndex].Value);
+ Assert.AreEqual(category.Item1.LowerBoundary, rowCells[lowerBoundaryColumnIndex].Value);
+ Assert.AreEqual(category.Item1.UpperBoundary, rowCells[upperBoundaryColumnIndex].Value);
+ }
+ }
+ }
+
+ private static Tuple CreateAssessmentSectionAssemblyCategory()
+ {
+ var random = new Random(39);
+ return new Tuple(new TestAssemblyCategory(random.NextDouble(), random.NextDouble()),
+ Color.FromKnownColor(random.NextEnumValue()),
+ random.NextEnumValue());
+ }
+
+ private class TestAssemblyCategory : AssemblyCategory
+ {
+ public TestAssemblyCategory(double lowerBoundary, double upperBoundary)
+ : base(lowerBoundary, upperBoundary) {}
+ }
+
+ private enum TestAssemblyCategoryGroup {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoryRowTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoryRowTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssemblyCategoryRowTest.cs (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -0,0 +1,90 @@
+// 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 Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.TypeConverters;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class AssemblyCategoryRowTest
+ {
+ [Test]
+ public void Constructor_AssemblyCategoryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var random = new Random(39);
+
+ // Call
+ TestDelegate test = () => new AssemblyCategoryRow(null,
+ Color.FromKnownColor(random.NextEnumValue()),
+ random.NextEnumValue());
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("assemblyCategory", paramName);
+ }
+
+ [Test]
+ public void Constructor_WithAssessmentSectionAssemblyCategory_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ double lowerBoundary = random.NextDouble();
+ double upperBoundary = random.NextDouble();
+ var categoryGroup = random.NextEnumValue();
+ Color categoryColor = Color.FromKnownColor(random.NextEnumValue());
+ var category = new TestAssemblyCategory(lowerBoundary, upperBoundary);
+
+ // Call
+ var categoryRow = new AssemblyCategoryRow(category, categoryColor, categoryGroup);
+
+ // Assert
+ Assert.AreEqual(categoryGroup, categoryRow.Group);
+ Assert.AreEqual(categoryColor, categoryRow.Color);
+ Assert.AreEqual(lowerBoundary, categoryRow.LowerBoundary);
+ Assert.AreEqual(upperBoundary, categoryRow.UpperBoundary);
+
+ TestHelper.AssertTypeConverter,
+ EnumTypeConverter>(nameof(AssemblyCategoryRow.Group));
+ TestHelper.AssertTypeConverter,
+ NoProbabilityValueDoubleConverter>(
+ nameof(AssemblyCategoryRow.LowerBoundary));
+ TestHelper.AssertTypeConverter,
+ NoProbabilityValueDoubleConverter>(
+ nameof(AssemblyCategoryRow.UpperBoundary));
+ }
+
+ private class TestAssemblyCategory : AssemblyCategory
+ {
+ public TestAssemblyCategory(double lowerBoundary, double upperBoundary)
+ : base(lowerBoundary, upperBoundary) {}
+ }
+
+ private enum TestAssemblyCategoryGroup {}
+ }
+}
\ No newline at end of file
Fisheye: Tag 0d4d9548637cbf814359cece7b551ca85b8378c3 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesTableTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs
===================================================================
diff -u -rf147b624dadd780d3186ec19c301d9ed1634504e -r0d4d9548637cbf814359cece7b551ca85b8378c3
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (.../AssessmentSectionAssemblyCategoriesViewTest.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (.../AssessmentSectionAssemblyCategoriesViewTest.cs) (revision 0d4d9548637cbf814359cece7b551ca85b8378c3)
@@ -69,7 +69,7 @@
Assert.AreEqual(1, view.Controls.Count);
Assert.AreSame(failureMechanismContribution, view.FailureMechanismContribution);
- AssessmentSectionAssemblyCategoriesTable tableControl = GetCategoriesTable(view);
+ AssemblyCategoriesTable tableControl = GetCategoriesTable(view);
Assert.NotNull(tableControl);
Assert.AreEqual(DockStyle.Fill, tableControl.Dock);
@@ -99,7 +99,7 @@
var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
- AssessmentSectionAssemblyCategoriesTable categoriesTable = GetCategoriesTable(view);
+ AssemblyCategoriesTable categoriesTable = GetCategoriesTable(view);
// Precondition
Assert.AreEqual(calculator.AssessmentSectionCategoriesOutput.Count(), categoriesTable.Rows.Count);
@@ -121,9 +121,10 @@
mocks.VerifyAll();
}
- private static AssessmentSectionAssemblyCategoriesTable GetCategoriesTable(AssessmentSectionAssemblyCategoriesView view)
+ private static AssemblyCategoriesTable GetCategoriesTable(AssessmentSectionAssemblyCategoriesView view)
{
- return ControlTestHelper.GetControls(view, "assessmentSectionAssemblyCategoriesTable").Single();
+ return ControlTestHelper.GetControls>(
+ view, "assessmentSectionAssemblyCategoriesTable").Single();
}
}
}
\ No newline at end of file
Fisheye: Tag 0d4d9548637cbf814359cece7b551ca85b8378c3 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?