Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -r73bb4932d13d36d1cd3cd30d8151f2adf49646f2 -r418185116fc7b5f87faae358aabb6dd3926fa983 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 73bb4932d13d36d1cd3cd30d8151f2adf49646f2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 418185116fc7b5f87faae358aabb6dd3926fa983) @@ -41,6 +41,7 @@ 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; @@ -269,8 +270,19 @@ Image = RingtoetsCommonFormsResources.GeneralOutputIcon, CloseForData = RingtoetsPluginHelper.ShouldCloseViewWithCalculationData, CreateInstance = context => new MacroStabilityInwardsOutputView(context.WrappedData, - () => GetNormativeAssessmentLevel(context.AssessmentSection, context.WrappedData)) + () => GetNormativeAssessmentLevel(context.AssessmentSection, context.WrappedData)) }; + + 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, + ((MacroStabilityInwardsFailureMechanism) context.WrappedData).MacroStabilityInwardsProbabilityAssessmentInput), + GetViewData = context => context.WrappedData.Sections + }; } public override IEnumerable GetTreeNodeInfos() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj =================================================================== diff -u -r6c7a703ee166f8e12f861be7150b359ce9d8a51e -r418185116fc7b5f87faae358aabb6dd3926fa983 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 6c7a703ee166f8e12f861be7150b359ce9d8a51e) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 418185116fc7b5f87faae358aabb6dd3926fa983) @@ -67,6 +67,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (revision 418185116fc7b5f87faae358aabb6dd3926fa983) @@ -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.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.ViewInfos +{ + [TestFixture] + public class MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest + { + private static ViewInfo info; + + [SetUp] + public void SetUp() + { + using (var plugin = new MacroStabilityInwardsPlugin()) + { + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(FailureMechanismSectionsProbabilityAssessmentView)); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(MacroStabilityInwardsFailureMechanismSectionsContext), 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 MacroStabilityInwardsFailureMechanism(); + var failureMechanismSectionsContext = new MacroStabilityInwardsFailureMechanismSectionsContext(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 MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoCloseForDataTester : 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 MacroStabilityInwardsProbabilityAssessmentInput()); + } + } + } +} \ No newline at end of file