Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/AssemblyCategoryGroupColorHelper.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/AssemblyCategoryGroupColorHelper.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/AssemblyCategoryGroupColorHelper.cs (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -0,0 +1,110 @@
+// 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 Ringtoets.AssemblyTool.Data;
+
+namespace Ringtoets.Common.Forms.Helpers
+{
+ ///
+ /// Helper class for determining the colors belonging to various assembly category groups.
+ ///
+ public static class AssemblyCategoryGroupColorHelper
+ {
+ ///
+ /// Gets the color for an assessment section assembly category group.
+ ///
+ /// The category group to get the color for.
+ /// The corresponding to the given category group.
+ /// Thrown when
+ /// has an invalid value for .
+ /// Thrown when
+ /// is not supported.
+ public static Color GetAssessmentSectionAssemblyCategoryGroupColor(AssessmentSectionAssemblyCategoryGroup assemblyCategoryGroup)
+ {
+ if (!Enum.IsDefined(typeof(AssessmentSectionAssemblyCategoryGroup), assemblyCategoryGroup))
+ {
+ throw new InvalidEnumArgumentException(nameof(assemblyCategoryGroup),
+ (int) assemblyCategoryGroup,
+ typeof(AssessmentSectionAssemblyCategoryGroup));
+ }
+
+ switch (assemblyCategoryGroup)
+ {
+ case AssessmentSectionAssemblyCategoryGroup.APlus:
+ return Color.FromArgb(0, 255, 0);
+ case AssessmentSectionAssemblyCategoryGroup.A:
+ return Color.FromArgb(118, 147, 60);
+ case AssessmentSectionAssemblyCategoryGroup.B:
+ return Color.FromArgb(255, 255, 0);
+ case AssessmentSectionAssemblyCategoryGroup.C:
+ return Color.FromArgb(255, 153, 0);
+ case AssessmentSectionAssemblyCategoryGroup.D:
+ return Color.FromArgb(255, 0, 0);
+ default:
+ throw new NotSupportedException();
+ }
+ }
+
+ ///
+ /// Gets the color for a failure mechanism assembly category group.
+ ///
+ /// The category group to get the color for.
+ /// The corresponding to the given category group.
+ /// Thrown when
+ /// has an invalid value for .
+ /// Thrown when
+ /// is not supported.
+ public static Color GetFailureMechanismSectionAssemblyCategoryGroupColor(FailureMechanismSectionAssemblyCategoryGroup assemblyCategoryGroup)
+ {
+ if (!Enum.IsDefined(typeof(FailureMechanismSectionAssemblyCategoryGroup), assemblyCategoryGroup))
+ {
+ throw new InvalidEnumArgumentException(nameof(assemblyCategoryGroup),
+ (int) assemblyCategoryGroup,
+ typeof(FailureMechanismSectionAssemblyCategoryGroup));
+ }
+
+ switch (assemblyCategoryGroup)
+ {
+ case FailureMechanismSectionAssemblyCategoryGroup.Iv:
+ return Color.FromArgb(0, 255, 0);
+ case FailureMechanismSectionAssemblyCategoryGroup.IIv:
+ return Color.FromArgb(118, 147, 60);
+ case FailureMechanismSectionAssemblyCategoryGroup.IIIv:
+ return Color.FromArgb(255, 255, 0);
+ case FailureMechanismSectionAssemblyCategoryGroup.IVv:
+ return Color.FromArgb(204, 192, 218);
+ case FailureMechanismSectionAssemblyCategoryGroup.Vv:
+ return Color.FromArgb(255, 153, 0);
+ case FailureMechanismSectionAssemblyCategoryGroup.VIv:
+ return Color.FromArgb(255, 0, 0);
+ case FailureMechanismSectionAssemblyCategoryGroup.VIIv:
+ case FailureMechanismSectionAssemblyCategoryGroup.None:
+ case FailureMechanismSectionAssemblyCategoryGroup.NotApplicable:
+ return Color.FromArgb(255, 255, 255);
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f147b624dadd780d3186ec19c301d9ed1634504e refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/AssemblyCategoryGroupHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs
===================================================================
diff -u -r6e0c3a3eec9feb30d964df279e76f2a8e6ae278f -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision 6e0c3a3eec9feb30d964df279e76f2a8e6ae278f)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -149,7 +149,7 @@
columnStateDefinition.Style = new CellStyle(
Color.FromKnownColor(KnownColor.ControlText),
- AssemblyCategoryGroupHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(assemblyCategoryGroup));
+ AssemblyCategoryGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(assemblyCategoryGroup));
}
///
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r723f31df6ebe679dd2e20de9ee3095f242379631 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 723f31df6ebe679dd2e20de9ee3095f242379631)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -110,42 +110,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 Categorie.
- ///
- public static string AssessmentSectionAssemblyCategory_Group_DisplayName {
- get {
- return ResourceManager.GetString("AssessmentSectionAssemblyCategory_Group_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 Is er een dam aanwezig?.
///
public static string BreakWater_HasBreakWater_Description {
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx
===================================================================
diff -u -r723f31df6ebe679dd2e20de9ee3095f242379631 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 723f31df6ebe679dd2e20de9ee3095f242379631)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -1399,16 +1399,4 @@
Normen
-
- Categorie
-
-
- Kleur
-
-
- Bovengrens [1/jaar]
-
-
- Ondergrens [1/jaar]
-
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r6e0c3a3eec9feb30d964df279e76f2a8e6ae278f -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 6e0c3a3eec9feb30d964df279e76f2a8e6ae278f)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -30,7 +30,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/AssemblyCategoryGroupColorHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/AssemblyCategoryGroupColorHelperTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/AssemblyCategoryGroupColorHelperTest.cs (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -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.ComponentModel;
+using System.Drawing;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.TestUtil;
+
+namespace Ringtoets.Common.Forms.Test.Helpers
+{
+ [TestFixture]
+ public class AssemblyCategoryGroupColorHelperTest
+ {
+ [Test]
+ public void GetFailureMechanismSectionAssemblyCategoryGroupColor_WithInvalidFailureMechanismSectionAssemblyCategoryGroup_ThrowsInvalidEnumArgumentException()
+ {
+ // Call
+ TestDelegate test = () => AssemblyCategoryGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(
+ (FailureMechanismSectionAssemblyCategoryGroup) 99);
+
+ // Assert
+ const string expectedMessage = "The value of argument 'assemblyCategoryGroup' (99) is invalid for Enum type 'FailureMechanismSectionAssemblyCategoryGroup'.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ [TestCaseSource(typeof(AssemblyCategoryColorTestHelper), nameof(AssemblyCategoryColorTestHelper.FailureMechanismSectionAssemblyCategoryGroupColorCases))]
+ public void GetFailureMechanismSectionAssemblyCategoryGroupColor_WithFailureMechanismSectionAssemblyCategoryGroup_ReturnsExpectedColor(
+ FailureMechanismSectionAssemblyCategoryGroup assemblyCategoryGroup, Color expectedColor)
+ {
+ // Call
+ Color color = AssemblyCategoryGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(assemblyCategoryGroup);
+
+ // Assert
+ Assert.AreEqual(expectedColor, color);
+ }
+
+ [Test]
+ public void GetAssessmentSectionAssemblyCategoryGroupColor_WithInvalidAssessmentSectionAssemblyCategoryGroup_ThrowsInvalidEnumArgumentException()
+ {
+ // Call
+ TestDelegate test = () => AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(
+ (AssessmentSectionAssemblyCategoryGroup) 99);
+
+ // Assert
+ const string expectedMessage = "The value of argument 'assemblyCategoryGroup' (99) is invalid for Enum type 'AssessmentSectionAssemblyCategoryGroup'.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ [TestCaseSource(typeof(AssemblyCategoryColorTestHelper), nameof(AssemblyCategoryColorTestHelper.AssessmentSectionAssemblyCategoryGroupColorCases))]
+ public void GetAssessmentSectionAssemblyCategoryGroupColor_WithAssessmentSectionAssemblyCategoryGroup_ReturnsExpectedColor(
+ AssessmentSectionAssemblyCategoryGroup assemblyCategoryGroup, Color expectedColor)
+ {
+ // Call
+ Color color = AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(assemblyCategoryGroup);
+
+ // Assert
+ Assert.AreEqual(expectedColor, color);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f147b624dadd780d3186ec19c301d9ed1634504e refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/AssemblyCategoryGroupHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r6e0c3a3eec9feb30d964df279e76f2a8e6ae278f -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 6e0c3a3eec9feb30d964df279e76f2a8e6ae278f)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -54,7 +54,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/AssemblyCategoryGroupTestHelperTest.cs
===================================================================
diff -u -r6e0c3a3eec9feb30d964df279e76f2a8e6ae278f -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/AssemblyCategoryGroupTestHelperTest.cs (.../AssemblyCategoryGroupTestHelperTest.cs) (revision 6e0c3a3eec9feb30d964df279e76f2a8e6ae278f)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/AssemblyCategoryGroupTestHelperTest.cs (.../AssemblyCategoryGroupTestHelperTest.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -34,7 +34,7 @@
public void FailureMechanismSectionAssemblyCategoryGroupColorCases_Always_ReturnsExpectedCases()
{
// Call
- IEnumerable colorCases = AssemblyCategoryColorTestHelper.FailureMechanismSectionAssemblyCategoryGroupColorCases.ToArray();
+ IEnumerable testCases = AssemblyCategoryColorTestHelper.FailureMechanismSectionAssemblyCategoryGroupColorCases.ToArray();
// Assert
var expectedCases = new[]
@@ -50,19 +50,19 @@
new TestCaseData(FailureMechanismSectionAssemblyCategoryGroup.VIIv, Color.FromArgb(255, 255, 255))
};
- Assert.AreEqual(expectedCases.Length, colorCases.Count());
- for (var i = 0; i < colorCases.Count(); i++)
+ Assert.AreEqual(expectedCases.Length, testCases.Count());
+ for (var i = 0; i < testCases.Count(); i++)
{
- Assert.AreEqual(expectedCases[i].Arguments[0], colorCases.ElementAt(i).Arguments[0]);
- Assert.AreEqual(expectedCases[i].Arguments[1], colorCases.ElementAt(i).Arguments[1]);
+ Assert.AreEqual(expectedCases[i].Arguments[0], testCases.ElementAt(i).Arguments[0]);
+ Assert.AreEqual(expectedCases[i].Arguments[1], testCases.ElementAt(i).Arguments[1]);
}
}
[Test]
public void AssessmentSectionAssemblyCategoryGroupColorCases_Always_ReturnsExpectedCases()
{
// Call
- IEnumerable colorCases = AssemblyCategoryColorTestHelper.AssessmentSectionAssemblyCategoryGroupColorCases.ToArray();
+ IEnumerable testCases = AssemblyCategoryColorTestHelper.AssessmentSectionAssemblyCategoryGroupColorCases.ToArray();
// Assert
var expectedCases = new[]
@@ -74,11 +74,11 @@
new TestCaseData(AssessmentSectionAssemblyCategoryGroup.D, Color.FromArgb(255, 0, 0))
};
- Assert.AreEqual(expectedCases.Length, colorCases.Count());
- for (var i = 0; i < colorCases.Count(); i++)
+ Assert.AreEqual(expectedCases.Length, testCases.Count());
+ for (var i = 0; i < testCases.Count(); i++)
{
- Assert.AreEqual(expectedCases[i].Arguments[0], colorCases.ElementAt(i).Arguments[0]);
- Assert.AreEqual(expectedCases[i].Arguments[1], colorCases.ElementAt(i).Arguments[1]);
+ Assert.AreEqual(expectedCases[i].Arguments[0], testCases.ElementAt(i).Arguments[0]);
+ Assert.AreEqual(expectedCases[i].Arguments[1], testCases.ElementAt(i).Arguments[1]);
}
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r93494e03be387a9ee0f6fed5e7e801529c78dc98 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 93494e03be387a9ee0f6fed5e7e801529c78dc98)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -137,6 +137,42 @@
}
///
+ /// 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 Categorie.
+ ///
+ public static string AssessmentSectionAssemblyCategory_Group_DisplayName {
+ get {
+ return ResourceManager.GetString("AssessmentSectionAssemblyCategory_Group_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 -r93494e03be387a9ee0f6fed5e7e801529c78dc98 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 93494e03be387a9ee0f6fed5e7e801529c78dc98)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -351,4 +351,16 @@
Overig ({0})
+
+ Kleur
+
+
+ Categorie
+
+
+ Ondergrens [1/jaar]
+
+
+ Bovengrens [1/jaar]
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesTable.cs
===================================================================
diff -u -r723f31df6ebe679dd2e20de9ee3095f242379631 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesTable.cs (.../AssessmentSectionAssemblyCategoriesTable.cs) (revision 723f31df6ebe679dd2e20de9ee3095f242379631)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesTable.cs (.../AssessmentSectionAssemblyCategoriesTable.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -23,7 +23,7 @@
using System.Linq;
using Core.Common.Controls.DataGrid;
using Ringtoets.AssemblyTool.Data;
-using Ringtoets.Common.Forms.Properties;
+using Ringtoets.Integration.Forms.Properties;
namespace Ringtoets.Integration.Forms.Views
{
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs
===================================================================
diff -u -r4d5f18805638d24f450406e9eda206b2f3591c36 -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (.../AssessmentSectionAssemblyCategoriesView.cs) (revision 4d5f18805638d24f450406e9eda206b2f3591c36)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (.../AssessmentSectionAssemblyCategoriesView.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -68,11 +68,7 @@
public FailureMechanismContribution FailureMechanismContribution { get; }
public object Data { get; set; }
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
+
protected override void Dispose(bool disposing)
{
failureMechanismContributionObserver.Dispose();
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoryRow.cs
===================================================================
diff -u -r04bef178c846add660097aeab97e3d35aefd939b -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoryRow.cs (.../AssessmentSectionAssemblyCategoryRow.cs) (revision 04bef178c846add660097aeab97e3d35aefd939b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoryRow.cs (.../AssessmentSectionAssemblyCategoryRow.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -32,7 +32,7 @@
///
/// This class represents a row displaying the properties of a .
///
- public class AssessmentSectionAssemblyCategoryRow
+ internal class AssessmentSectionAssemblyCategoryRow
{
///
/// Creates a new instance of .
@@ -47,16 +47,17 @@
throw new ArgumentNullException(nameof(assessmentSectionAssemblyCategory));
}
- Group = new EnumDisplayWrapper(assessmentSectionAssemblyCategory.Group).DisplayName;
- Color = AssemblyCategoryGroupHelper.GetAssessmentSectionAssemblyCategoryGroupColor(assessmentSectionAssemblyCategory.Group);
+ Group = assessmentSectionAssemblyCategory.Group;
+ Color = AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(assessmentSectionAssemblyCategory.Group);
UpperBoundary = assessmentSectionAssemblyCategory.UpperBoundary;
LowerBoundary = assessmentSectionAssemblyCategory.LowerBoundary;
}
///
/// Gets the display name of the category group.
///
- public string Group { get; }
+ [TypeConverter(typeof(EnumTypeConverter))]
+ public AssessmentSectionAssemblyCategoryGroup Group { get; }
///
/// Gets the color of the category.
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesTableTest.cs
===================================================================
diff -u -r04bef178c846add660097aeab97e3d35aefd939b -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesTableTest.cs (.../AssessmentSectionAssemblyCategoriesTableTest.cs) (revision 04bef178c846add660097aeab97e3d35aefd939b)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesTableTest.cs (.../AssessmentSectionAssemblyCategoriesTableTest.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -163,8 +163,8 @@
AssessmentSectionAssemblyCategory category = categories[i];
DataGridViewCellCollection rowCells = table.Rows[i].Cells;
- Assert.AreEqual(new EnumDisplayWrapper(category.Group).DisplayName, rowCells[categoryGroupColumnIndex].Value);
- Assert.AreEqual(AssemblyCategoryGroupHelper.GetAssessmentSectionAssemblyCategoryGroupColor(category.Group), rowCells[colorColumnIndex].Value);
+ Assert.AreEqual(category.Group, rowCells[categoryGroupColumnIndex].Value);
+ Assert.AreEqual(AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(category.Group), rowCells[colorColumnIndex].Value);
Assert.AreEqual(category.LowerBoundary, rowCells[lowerBoundaryColumnIndex].Value);
Assert.AreEqual(category.UpperBoundary, rowCells[upperBoundaryColumnIndex].Value);
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs
===================================================================
diff -u -rebca6343380bd74afcdb2c0bf4f98de0844c07af -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (.../AssessmentSectionAssemblyCategoriesViewTest.cs) (revision ebca6343380bd74afcdb2c0bf4f98de0844c07af)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (.../AssessmentSectionAssemblyCategoriesViewTest.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -24,6 +24,7 @@
using System.Windows.Forms;
using Core.Common.Base;
using Core.Common.Controls.Views;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.AssemblyTool.Data;
@@ -52,7 +53,7 @@
}
[Test]
- public void Constructor_WithData_CreatesViewAndTableWithData()
+ public void Constructor_WithFailureMechanismContribution_CreatesViewAndTableWithData()
{
// Setup
FailureMechanismContribution failureMechanismContribution = FailureMechanismContributionTestFactory.CreateFailureMechanismContribution();
@@ -71,42 +72,50 @@
AssessmentSectionAssemblyCategoriesTable tableControl = GetCategoriesTable(view);
Assert.NotNull(tableControl);
Assert.AreEqual(DockStyle.Fill, tableControl.Dock);
- Assert.AreEqual(3, tableControl.Rows.Count);
+
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
+ Assert.AreEqual(calculator.AssessmentSectionCategoriesOutput.Count(), tableControl.Rows.Count);
}
}
[Test]
public void GivenViewWithFailureMechanismContribution_WhenFailureMechanismContributionUpdated_ThenDataTableUpdated()
{
// Given
+ var random = new Random(21);
+
var mocks = new MockRepository();
var observer = mocks.StrictMock();
observer.Expect(o => o.UpdateObserver());
mocks.ReplayAll();
FailureMechanismContribution failureMechanismContribution = FailureMechanismContributionTestFactory.CreateFailureMechanismContribution();
+ failureMechanismContribution.Attach(observer);
using (new AssemblyToolCalculatorFactoryConfig())
using (var view = new AssessmentSectionAssemblyCategoriesView(failureMechanismContribution))
{
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
+
AssessmentSectionAssemblyCategoriesTable categoriesTable = GetCategoriesTable(view);
- failureMechanismContribution.Attach(observer);
// Precondition
- Assert.AreEqual(3, categoriesTable.Rows.Count);
+ Assert.AreEqual(calculator.AssessmentSectionCategoriesOutput.Count(), categoriesTable.Rows.Count);
// When
- var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
- AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
-
- calculator.AssessmentSectionCategoriesOutput = new[]
+ var newOutput = new[]
{
- new AssessmentSectionAssemblyCategory(1, 2, AssessmentSectionAssemblyCategoryGroup.A)
+ new AssessmentSectionAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue())
};
+ calculator.AssessmentSectionCategoriesOutput = newOutput;
failureMechanismContribution.NotifyObservers();
// Then
- Assert.AreEqual(1, categoriesTable.Rows.Count);
+ Assert.AreEqual(newOutput.Length, categoriesTable.Rows.Count);
}
mocks.VerifyAll();
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs
===================================================================
diff -u -r04bef178c846add660097aeab97e3d35aefd939b -rf147b624dadd780d3186ec19c301d9ed1634504e
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs (.../AssessmentSectionAssemblyCategoryRowTest.cs) (revision 04bef178c846add660097aeab97e3d35aefd939b)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs (.../AssessmentSectionAssemblyCategoryRowTest.cs) (revision f147b624dadd780d3186ec19c301d9ed1634504e)
@@ -21,6 +21,7 @@
using System;
using Core.Common.TestUtil;
+using Core.Common.Util;
using NUnit.Framework;
using Ringtoets.AssemblyTool.Data;
using Ringtoets.Common.Forms.Helpers;
@@ -44,30 +45,27 @@
}
[Test]
- [TestCase(AssessmentSectionAssemblyCategoryGroup.APlus, "A+")]
- [TestCase(AssessmentSectionAssemblyCategoryGroup.A, "A")]
- [TestCase(AssessmentSectionAssemblyCategoryGroup.B, "B")]
- [TestCase(AssessmentSectionAssemblyCategoryGroup.C, "C")]
- [TestCase(AssessmentSectionAssemblyCategoryGroup.D, "D")]
- public void Constructor_WithAssessmentSectionAssemblyCategory_ExpectedValues(
- AssessmentSectionAssemblyCategoryGroup categoryGroup, string expectedName)
+ public void Constructor_WithAssessmentSectionAssemblyCategory_ExpectedValues()
{
// Setup
var random = new Random(39);
double lowerBoundary = random.NextDouble();
double upperBoundary = random.NextDouble();
+ var categoryGroup = random.NextEnumValue();
var category = new AssessmentSectionAssemblyCategory(lowerBoundary, upperBoundary, categoryGroup);
// Call
var categoryRow = new AssessmentSectionAssemblyCategoryRow(category);
// Assert
- Assert.AreEqual(expectedName, categoryRow.Group);
- Assert.AreEqual(AssemblyCategoryGroupHelper.GetAssessmentSectionAssemblyCategoryGroupColor(categoryGroup), categoryRow.Color);
+ Assert.AreEqual(categoryGroup, categoryRow.Group);
+ Assert.AreEqual(AssemblyCategoryGroupColorHelper.GetAssessmentSectionAssemblyCategoryGroupColor(categoryGroup), categoryRow.Color);
Assert.AreEqual(lowerBoundary, categoryRow.LowerBoundary);
Assert.AreEqual(upperBoundary, categoryRow.UpperBoundary);
TestHelper.AssertTypeConverter(nameof(AssessmentSectionAssemblyCategoryRow.Group));
+ TestHelper.AssertTypeConverter(
nameof(AssessmentSectionAssemblyCategoryRow.LowerBoundary));
TestHelper.AssertTypeConverter tni.ViewType == typeof(AssessmentSectionAssemblyCategoriesView));
}
@@ -99,10 +97,8 @@
public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
{
// Setup
+ var mocks = new MockRepository();
IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(null, mocks);
- assessmentSection.Stub(section => section.Composition)
- .Return(AssessmentSectionComposition.Dike);
-
mocks.ReplayAll();
using (new AssemblyToolCalculatorFactoryConfig())
@@ -122,13 +118,9 @@
public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
{
// Setup
+ var mocks = new MockRepository();
IAssessmentSection assessmentSection1 = AssessmentSectionHelper.CreateAssessmentSectionStub(null, mocks);
- assessmentSection1.Stub(section => section.Composition)
- .Return(AssessmentSectionComposition.DikeAndDune);
-
IAssessmentSection assessmentSection2 = AssessmentSectionHelper.CreateAssessmentSectionStub(null, mocks);
- assessmentSection2.Stub(section => section.Composition)
- .Return(AssessmentSectionComposition.DikeAndDune);
mocks.ReplayAll();
using (new AssemblyToolCalculatorFactoryConfig())