Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs
===================================================================
diff -u -r2ecbb5230248dc9f9b6706a0fd8ced09c9cd62c7 -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision 2ecbb5230248dc9f9b6706a0fd8ced09c9cd62c7)
+++ Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -84,14 +84,14 @@
}
[TestFixture]
- public class ShouldCloseFailureMechanismSectionsViewTest : ShouldCloseFailureMechanismSectionsViewTester
+ public class ShouldCloseFailureMechanismSectionsViewForDataTester : ShouldCloseViewWithFailureMechanismTester
{
- protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o)
+ protected override bool ShouldCloseMethod(IView view, object o)
{
- return RingtoetsPluginHelper.ShouldCloseFailureMechanismSectionsView(view, o);
+ return RingtoetsPluginHelper.ShouldCloseFailureMechanismSectionsView((FailureMechanismSectionsView) view, o);
}
- protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism)
+ protected override IView GetView(IFailureMechanism failureMechanism)
{
return new TestFailureMechanismSectionsView(failureMechanism);
}
Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/Ringtoets.Common.Plugin.TestUtil.csproj
===================================================================
diff -u -r88a027f5282f504c25327525a3bf2e2e4950b09f -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/Ringtoets.Common.Plugin.TestUtil.csproj (.../Ringtoets.Common.Plugin.TestUtil.csproj) (revision 88a027f5282f504c25327525a3bf2e2e4950b09f)
+++ Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/Ringtoets.Common.Plugin.TestUtil.csproj (.../Ringtoets.Common.Plugin.TestUtil.csproj) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -21,7 +21,7 @@
-
+
@@ -39,6 +39,14 @@
{9A2D67E6-26AC-4D17-B11A-2B4372F2F572}
Core.Common.Controls
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Ringtoets.AssemblyTool.Data
+
+
+ {AD0CDC89-0A00-4068-AEEC-9838863C2FE8}
+ Ringtoets.Integration.Forms
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Fisheye: Tag 32994139e33b5ef8110cae9d8a15647c5afa2bc9 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseFailureMechanismSectionsViewTester.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -0,0 +1,181 @@
+// 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.Linq;
+using Core.Common.Controls.Views;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
+
+namespace Ringtoets.Common.Plugin.TestUtil
+{
+ ///
+ /// Class for testing for views related to a failure mechanism.
+ ///
+ [TestFixture]
+ public abstract class ShouldCloseViewWithFailureMechanismTester
+ {
+ [Test]
+ public void ShouldCloseMethod_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(Enumerable.Empty());
+ mocks.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism();
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, assessmentSection);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ShouldCloseMethod_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[]
+ {
+ failureMechanism
+ });
+ mocks.ReplayAll();
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, assessmentSection);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ShouldCloseMethod_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, new TestFailureMechanism());
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+ }
+
+ [Test]
+ public void ShouldCloseMethod_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, failureMechanism);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+ }
+
+ [Test]
+ public void ShouldCloseMethod_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism();
+ var failureMechanismContext = new FailureMechanismContext(new TestFailureMechanism(), assessmentSection);
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, failureMechanismContext);
+
+ // Assert
+ Assert.IsFalse(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ShouldCloseMethod_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism();
+ var failureMechanismContext = new FailureMechanismContext(failureMechanism, assessmentSection);
+
+ using (IView view = GetView(failureMechanism))
+ {
+ // Call
+ bool closeForData = ShouldCloseMethod(view, failureMechanismContext);
+
+ // Assert
+ Assert.IsTrue(closeForData);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ ///
+ /// Performs the method that must be tested.
+ ///
+ /// The failure mechanism sections view involved.
+ /// The object involved.
+ /// Whether the view should close or not.
+ protected abstract bool ShouldCloseMethod(IView view, object o);
+
+ ///
+ /// Gets a view for testing purposes.
+ ///
+ /// The failure mechanism containing the data to set to the view.
+ /// A view object.
+ protected abstract IView GetView(IFailureMechanism data);
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -rcf6e174357c55b6a2252536804c395ba1194bdb8 -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision cf6e174357c55b6a2252536804c395ba1194bdb8)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -587,6 +587,28 @@
CloseForData = CloseAssemblyResultPerSectionViewForData,
CreateInstance = context => new AssemblyResultPerSectionView(context.WrappedData)
};
+
+ yield return new ViewInfo
+ {
+ GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ Image = RingtoetsCommonFormsResources.NormsIcon,
+ CloseForData = CloseFailureMechanismAssemblyCategoriesViewForData,
+ CreateInstance = context => new FailureMechanismAssemblyCategoriesView(context.WrappedData,
+ context.AssessmentSection,
+ context.GetFailureMechanismCategoriesFunc,
+ context.GetFailureMechanismSectionAssemblyCategoriesFunc)
+ };
+
+ yield return new ViewInfo
+ {
+ GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName,
+ Image = RingtoetsCommonFormsResources.NormsIcon,
+ CloseForData = CloseFailureMechanismAssemblyCategoriesViewForData,
+ CreateInstance = context => new FailureMechanismAssemblyCategoriesView(context.WrappedData,
+ context.AssessmentSection,
+ context.GetFailureMechanismCategoriesFunc,
+ context.GetFailureMechanismSectionAssemblyCategoriesFunc)
+ };
}
public override IEnumerable GetImportInfos()
@@ -1158,6 +1180,31 @@
#endregion
+ #region FailureMechanismResults ViewInfo
+
+ private static bool CloseFailureMechanismAssemblyCategoriesViewForData(FailureMechanismAssemblyCategoriesView view, object dataToCloseFor)
+ {
+ var assessmentSection = dataToCloseFor as IAssessmentSection;
+ var failureMechanism = dataToCloseFor as IFailureMechanism;
+ var failureMechanismContext = dataToCloseFor as IFailureMechanismContext;
+
+ if (assessmentSection != null)
+ {
+ return assessmentSection
+ .GetFailureMechanisms()
+ .Any(fm => ReferenceEquals(view.FailureMechanism, fm));
+ }
+
+ if (failureMechanismContext != null)
+ {
+ failureMechanism = failureMechanismContext.WrappedData;
+ }
+
+ return failureMechanism != null && ReferenceEquals(view.FailureMechanism, failureMechanism);
+ }
+
+ #endregion
+
#region HydraulicBoundaryCalculationsView ViewInfo
private static bool CloseHydraulicBoundaryCalculationsViewForData(HydraulicBoundaryCalculationsView view, object dataToCloseFor)
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -r2018b9555ce1ea7636921c6303f6477a934015cb -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 2018b9555ce1ea7636921c6303f6477a934015cb)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -105,6 +105,8 @@
+
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs
===================================================================
diff -u -rd520a1dd8a435c8de3ae5aab1c02b4be9627b67d -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision d520a1dd8a435c8de3ae5aab1c02b4be9627b67d)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -376,7 +376,7 @@
ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray();
// Assert
- Assert.AreEqual(19, viewInfos.Length);
+ Assert.AreEqual(21, viewInfos.Length);
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
@@ -488,6 +488,18 @@
typeof(AssemblyResultPerSectionContext),
typeof(AssessmentSection),
typeof(AssemblyResultPerSectionView));
+
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(FailureMechanismAssemblyCategoriesContext),
+ typeof(FailureMechanismAssemblyCategoriesContext),
+ typeof(FailureMechanismAssemblyCategoriesView));
+
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext),
+ typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext),
+ typeof(FailureMechanismAssemblyCategoriesView));
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -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.Linq;
+using Core.Common.Controls.Views;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Plugin.TestUtil;
+using Ringtoets.Integration.Forms.Views;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyCategoriesViewInfoTest
+ {
+ private static ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ using (var plugin = new RingtoetsPlugin())
+ {
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismAssemblyCategoriesView)
+ && tni.DataType == typeof(FailureMechanismAssemblyCategoriesContext));
+ }
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(FailureMechanismAssemblyCategoriesContext), info.DataType);
+ Assert.AreEqual(typeof(FailureMechanismAssemblyCategoriesContext), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Categoriegrenzen", viewName);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_SetsExpectedViewProperties()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSectionStub();
+ var failureMechanism = new TestFailureMechanism();
+ var failureMechanismAssemblyCategoriesContext = new FailureMechanismAssemblyCategoriesContext(failureMechanism,
+ assessmentSection,
+ () => new Random(39).NextDouble());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Call
+ var view = (FailureMechanismAssemblyCategoriesView) info.CreateInstance(failureMechanismAssemblyCategoriesContext);
+
+ // Assert
+ Assert.AreSame(failureMechanism, view.FailureMechanism);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnsNormIcon()
+ {
+ // Call
+ Image image = info.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.NormsIcon, image);
+ }
+
+ [TestFixture]
+ public class ShouldCloseFailureMechanismAssemblyCategoriesViewForDataTester : ShouldCloseViewWithFailureMechanismTester
+ {
+ protected override bool ShouldCloseMethod(IView view, object o)
+ {
+ return info.CloseForData(view, o);
+ }
+
+ protected override IView GetView(IFailureMechanism failureMechanism)
+ {
+ return new FailureMechanismAssemblyCategoriesView(failureMechanism,
+ new AssessmentSectionStub(),
+ Enumerable.Empty,
+ Enumerable.Empty);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs
===================================================================
diff -u -r4abbfc484024001a04add8b2634777acb246cd83 -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 4abbfc484024001a04add8b2634777acb246cd83)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
+using Core.Common.Controls.Views;
using Core.Common.Gui.Plugin;
using Core.Common.TestUtil;
using NUnit.Framework;
@@ -98,14 +99,14 @@
}
[TestFixture]
- public class FailureMechanismSectionsViewInfoCloseForDataTester : ShouldCloseFailureMechanismSectionsViewTester
+ public class ShouldCloseFailureMechanismSectionsViewForDataTester : ShouldCloseViewWithFailureMechanismTester
{
- protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o)
+ protected override bool ShouldCloseMethod(IView view, object o)
{
return info.CloseForData(view, o);
}
- protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism)
+ protected override IView GetView(IFailureMechanism failureMechanism)
{
return new FailureMechanismSectionsView(failureMechanism.Sections, failureMechanism);
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest.cs (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -0,0 +1,121 @@
+// 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.Linq;
+using Core.Common.Controls.Views;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.PresentationObjects;
+using Ringtoets.Common.Plugin.TestUtil;
+using Ringtoets.Integration.Forms.Views;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.ViewInfos
+{
+ [TestFixture]
+ public class GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest
+ {
+ private static ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ using (var plugin = new RingtoetsPlugin())
+ {
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismAssemblyCategoriesView)
+ && tni.DataType == typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext));
+ }
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext), info.DataType);
+ Assert.AreEqual(typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewName_Always_ReturnsViewName()
+ {
+ // Call
+ string viewName = info.GetViewName(null, null);
+
+ // Assert
+ Assert.AreEqual("Categoriegrenzen", viewName);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_SetsExpectedViewProperties()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSectionStub();
+ var failureMechanism = new TestFailureMechanism();
+ var geotechnicalFailureMechanismAssemblyCategoriesContext = new GeotechnicalFailureMechanismAssemblyCategoriesContext(failureMechanism,
+ assessmentSection,
+ () => new Random(39).NextDouble());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Call
+ var view = (FailureMechanismAssemblyCategoriesView) info.CreateInstance(geotechnicalFailureMechanismAssemblyCategoriesContext);
+
+ // Assert
+ Assert.AreSame(failureMechanism, view.FailureMechanism);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnsNormIcon()
+ {
+ // Call
+ Image image = info.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.NormsIcon, image);
+ }
+
+ [TestFixture]
+ public class ShouldCloseGeotechnicalFailureMechanismAssemblyCategoriesViewForDataTester
+ : ShouldCloseViewWithFailureMechanismTester
+ {
+ protected override bool ShouldCloseMethod(IView view, object o)
+ {
+ return info.CloseForData(view, o);
+ }
+
+ protected override IView GetView(IFailureMechanism failureMechanism)
+ {
+ return new FailureMechanismAssemblyCategoriesView(failureMechanism,
+ new AssessmentSectionStub(),
+ Enumerable.Empty,
+ Enumerable.Empty);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs
===================================================================
diff -u -r418185116fc7b5f87faae358aabb6dd3926fa983 -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 418185116fc7b5f87faae358aabb6dd3926fa983)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
+using Core.Common.Controls.Views;
using Core.Common.Gui.Plugin;
using Core.Common.TestUtil;
using NUnit.Framework;
@@ -98,14 +99,14 @@
}
[TestFixture]
- public class MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoCloseForDataTester : ShouldCloseFailureMechanismSectionsViewTester
+ public class ShouldCloseMacroStabilityInwardsSectionsViewForDataTester : ShouldCloseViewWithFailureMechanismTester
{
- protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o)
+ protected override bool ShouldCloseMethod(IView view, object o)
{
return info.CloseForData(view, o);
}
- protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism)
+ protected override IView GetView(IFailureMechanism failureMechanism)
{
return new FailureMechanismSectionsProbabilityAssessmentView(failureMechanism.Sections,
failureMechanism,
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs
===================================================================
diff -u -r4abbfc484024001a04add8b2634777acb246cd83 -r32994139e33b5ef8110cae9d8a15647c5afa2bc9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 4abbfc484024001a04add8b2634777acb246cd83)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9)
@@ -22,6 +22,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
+using Core.Common.Controls.Views;
using Core.Common.Gui.Plugin;
using Core.Common.TestUtil;
using NUnit.Framework;
@@ -98,14 +99,14 @@
}
[TestFixture]
- public class PipingFailureMechanismSectionsProbabilityAssessmentViewInfoCloseForDataTester : ShouldCloseFailureMechanismSectionsViewTester
+ public class ShouldClosePipingSectionsViewForDataTester : ShouldCloseViewWithFailureMechanismTester
{
- protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o)
+ protected override bool ShouldCloseMethod(IView view, object o)
{
return info.CloseForData(view, o);
}
- protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism)
+ protected override IView GetView(IFailureMechanism failureMechanism)
{
return new FailureMechanismSectionsProbabilityAssessmentView(failureMechanism.Sections,
failureMechanism,