Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs =================================================================== diff -u -r34f83cd0a18bf396a2b1551a0fb5fbb3f3125dc7 -r4abbfc484024001a04add8b2634777acb246cd83 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 34f83cd0a18bf396a2b1551a0fb5fbb3f3125dc7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 4abbfc484024001a04add8b2634777acb246cd83) @@ -39,12 +39,15 @@ [TestFixture] public class FailureMechanismSectionsViewInfoTest { - private ViewInfo info; + private static ViewInfo info; [SetUp] public void SetUp() { - info = GetViewInfo(); + using (var plugin = new RingtoetsPlugin()) + { + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismSectionsView)); + } } [Test] @@ -99,21 +102,13 @@ { protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o) { - return GetViewInfo().CloseForData(view, o); + return info.CloseForData(view, o); } protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism) { return new FailureMechanismSectionsView(failureMechanism.Sections, failureMechanism); } } - - private static ViewInfo GetViewInfo() - { - using (var plugin = new RingtoetsPlugin()) - { - return plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismSectionsView)); - } - } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r73bb4932d13d36d1cd3cd30d8151f2adf49646f2 -r4abbfc484024001a04add8b2634777acb246cd83 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 73bb4932d13d36d1cd3cd30d8151f2adf49646f2) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 4abbfc484024001a04add8b2634777acb246cd83) @@ -41,9 +41,11 @@ using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.TreeNodeInfos; +using Ringtoets.Common.Forms.Views; using Ringtoets.Common.IO.FileImporters.MessageProviders; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SurfaceLines; +using Ringtoets.Common.Plugin; using Ringtoets.Common.Service; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.SoilProfile; @@ -254,6 +256,17 @@ CreateInstance = context => new PipingScenariosView(context.AssessmentSection), AfterCreate = (view, context) => { view.PipingFailureMechanism = context.FailureMechanism; } }; + + yield return new ViewInfo, FailureMechanismSectionsProbabilityAssessmentView> + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismSections_DisplayName, + Image = RingtoetsCommonFormsResources.SectionsIcon, + CloseForData = RingtoetsPluginHelper.ShouldCloseFailureMechanismSectionsView, + CreateInstance = context => new FailureMechanismSectionsProbabilityAssessmentView(context.WrappedData.Sections, + context.WrappedData, + ((PipingFailureMechanism) context.WrappedData).PipingProbabilityAssessmentInput), + GetViewData = context => context.WrappedData.Sections + }; } public override IEnumerable GetTreeNodeInfos() Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj =================================================================== diff -u -rac96d7c315129af851634ed5a4a6800b59ede718 -r4abbfc484024001a04add8b2634777acb246cd83 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision ac96d7c315129af851634ed5a4a6800b59ede718) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 4abbfc484024001a04add8b2634777acb246cd83) @@ -81,6 +81,11 @@ Ringtoets.Common.IO False + + {8513B8D6-79C8-4173-B663-59C91AC65E5F} + Ringtoets.Common.Plugin + False + {D951D6DA-FE83-4920-9FDB-63BF96480B54} Ringtoets.Common.Service Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj =================================================================== diff -u -re1a93747d105f27392f4bc0655694810c7d29f4d -r4abbfc484024001a04add8b2634777acb246cd83 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision e1a93747d105f27392f4bc0655694810c7d29f4d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 4abbfc484024001a04add8b2634777acb246cd83) @@ -68,6 +68,7 @@ + @@ -127,6 +128,10 @@ {4843D6E5-066F-4795-94F5-1D53932DD03C} Ringtoets.Common.Data.TestUtil + + {6346BADF-D331-4948-9772-08E8CD1E1FC9} + Ringtoets.Common.Plugin.TestUtil + {52093DA6-D545-476A-ADFD-12F56625E36B} Ringtoets.Common.Service.TestUtil Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (revision 4abbfc484024001a04add8b2634777acb246cd83) @@ -0,0 +1,116 @@ +// 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.Collections.Generic; +using System.Drawing; +using System.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Plugin.TestUtil; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Piping.Plugin.Test.ViewInfos +{ + [TestFixture] + public class PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest + { + private static ViewInfo info; + + [SetUp] + public void SetUp() + { + using (var plugin = new PipingPlugin()) + { + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismSectionsProbabilityAssessmentView)); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(PipingFailureMechanismSectionsContext), info.DataType); + Assert.AreEqual(typeof(IEnumerable), info.ViewDataType); + } + + [Test] + public void GetViewName_Always_ReturnsViewName() + { + // Call + string viewName = info.GetViewName(null, null); + + // Assert + Assert.AreEqual("Vakindeling", viewName); + } + + [Test] + public void GetViewData_Always_ReturnsFailureMechanismSections() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingFailureMechanism(); + var failureMechanismSectionsContext = new PipingFailureMechanismSectionsContext(failureMechanism, assessmentSection); + + // Call + object viewData = info.GetViewData(failureMechanismSectionsContext); + + // Assert + Assert.AreSame(failureMechanism.Sections, viewData); + mocks.VerifyAll(); + } + + [Test] + public void Image_Always_ReturnsSectionsIcon() + { + // Call + Image image = info.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image); + } + + [TestFixture] + public class PipingFailureMechanismSectionsProbabilityAssessmentViewInfoCloseForDataTester : ShouldCloseFailureMechanismSectionsViewTester + { + protected override bool ShouldCloseMethod(FailureMechanismSectionsView view, object o) + { + return info.CloseForData(view, o); + } + + protected override FailureMechanismSectionsView GetView(IFailureMechanism failureMechanism) + { + return new FailureMechanismSectionsProbabilityAssessmentView(failureMechanism.Sections, + failureMechanism, + new PipingProbabilityAssessmentInput()); + } + } + } +} \ No newline at end of file