Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs (.../MacroStabilityInwardsOutputContext.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsOutputContext.cs (.../MacroStabilityInwardsOutputContext.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -28,13 +28,13 @@ /// /// A presentation layer object which wraps a and a . /// - public class MacroStabilityInwardsOutputContext : ObservableWrappedObjectContextBase + public class MacroStabilityInwardsOutputContext : ObservableWrappedObjectContextBase { /// /// Creates a new instance of . /// /// The wrapped data. /// Thrown when is null. - public MacroStabilityInwardsOutputContext(MacroStabilityInwardsCalculation wrappedData) : base(wrappedData) {} + public MacroStabilityInwardsOutputContext(MacroStabilityInwardsCalculationScenario wrappedData) : base(wrappedData) {} } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -42,6 +42,7 @@ using Ringtoets.Common.IO.FileImporters.MessageProviders; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SurfaceLines; +using Ringtoets.Common.Plugin; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms; @@ -241,6 +242,14 @@ CloseForData = CloseScenariosViewForData, AfterCreate = (view, context) => { view.MacroStabilityInwardsFailureMechanism = context.ParentFailureMechanism; } }; + + yield return new ViewInfo + { + GetViewData = context => context.WrappedData, + GetViewName = (view, output) => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, + Image = MacroStabilityInwardsFormsResources.MacroStabilityInwardsInputIcon, + CloseForData = RingtoetsPluginHelper.ShouldCloseViewWithCalculationData + }; } public override IEnumerable GetTreeNodeInfos() Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj =================================================================== diff -u -r91dfcac4a3eff0748168e9fc8e9400e209844363 -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.csproj) (revision 91dfcac4a3eff0748168e9fc8e9400e209844363) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/Ringtoets.MacroStabilityInwards.Plugin.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.csproj) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -109,6 +109,11 @@ Ringtoets.Common.IO False + + {8513B8D6-79C8-4173-B663-59C91AC65E5F} + Ringtoets.Common.Plugin + False + {D951D6DA-FE83-4920-9FDB-63BF96480B54} Ringtoets.Common.Service Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs (.../MacroStabilityInwardsOutputContextTest.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/MacroStabilityInwardsOutputContextTest.cs (.../MacroStabilityInwardsOutputContextTest.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -33,13 +33,13 @@ public void Constructor_WithOutputParameters_PropertiesSet() { // Setup - var calculation = new MacroStabilityInwardsCalculation(); + var calculation = new MacroStabilityInwardsCalculationScenario(); // Call var context = new MacroStabilityInwardsOutputContext(calculation); // Assert - Assert.IsInstanceOf>(context); + Assert.IsInstanceOf>(context); Assert.AreSame(calculation, context.WrappedData); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputContextPropertiesTest.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputContextPropertiesTest.cs (.../MacroStabilityInwardsOutputContextPropertiesTest.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsOutputContextPropertiesTest.cs (.../MacroStabilityInwardsOutputContextPropertiesTest.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -68,7 +68,7 @@ var output = new TestMacroStabilityInwardsOutput(new MacroStabilityInwardsOutput.ConstructionProperties()); - var calculation = new MacroStabilityInwardsCalculation + var calculation = new MacroStabilityInwardsCalculationScenario { Output = output, SemiProbabilisticOutput = semiProbabilisticOutput @@ -96,7 +96,7 @@ public void GetProperties_WithZeroValues_ReturnTranslatedFormat() { // Setup - var calculation = new MacroStabilityInwardsCalculation + var calculation = new MacroStabilityInwardsCalculationScenario { Output = new TestMacroStabilityInwardsOutput(), SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() @@ -118,7 +118,7 @@ public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup - var calculation = new MacroStabilityInwardsCalculation + var calculation = new MacroStabilityInwardsCalculationScenario { Output = new TestMacroStabilityInwardsOutput(), SemiProbabilisticOutput = new TestMacroStabilityInwardsSemiProbabilisticOutput() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/MacroStabilityInwardsPluginTest.cs (.../MacroStabilityInwardsPluginTest.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -140,7 +140,7 @@ ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray(); // Assert - Assert.AreEqual(5, viewInfos.Length); + Assert.AreEqual(6, viewInfos.Length); PluginTestHelper.AssertViewInfoDefined( viewInfos, @@ -170,6 +170,12 @@ typeof(MacroStabilityInwardsScenariosContext), typeof(CalculationGroup), typeof(MacroStabilityInwardsScenariosView)); + + PluginTestHelper.AssertViewInfoDefined( + viewInfos, + typeof(MacroStabilityInwardsOutputContext), + typeof(MacroStabilityInwardsCalculationScenario), + typeof(MacroStabilityInwardsOutputView)); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/Ringtoets.MacroStabilityInwards.Plugin.Test.csproj (.../Ringtoets.MacroStabilityInwards.Plugin.Test.csproj) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -106,6 +106,7 @@ + @@ -161,6 +162,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/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs =================================================================== diff -u -r10fc7315f4478647b2708f74c3e596cdf0e5a98c -rea495159c320abdbbd9fe4e4dd37c98672116c6b --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs) (revision 10fc7315f4478647b2708f74c3e596cdf0e5a98c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsOutputContextTreeNodeInfoTest.cs) (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -132,7 +132,7 @@ public void ForeColor_HasOutputTrue_ReturnControlText() { // Setup - var calculation = new MacroStabilityInwardsCalculation + var calculation = new MacroStabilityInwardsCalculationScenario { Output = new TestMacroStabilityInwardsOutput() }; @@ -148,7 +148,7 @@ public void ForeColor_HasOutputFalse_ReturnGrayText() { // Setup - var calculation = new MacroStabilityInwardsCalculation(); + var calculation = new MacroStabilityInwardsCalculationScenario(); // Call Color color = info.ForeColor(new MacroStabilityInwardsOutputContext(calculation)); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsOutputViewTest.cs (revision ea495159c320abdbbd9fe4e4dd37c98672116c6b) @@ -0,0 +1,117 @@ +// 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 Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Plugin.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.Forms.Properties; +using Ringtoets.MacroStabilityInwards.Forms.Views; + +namespace Ringtoets.MacroStabilityInwards.Plugin.Test.ViewInfos +{ + [TestFixture] + public class MacroStabilityInwardsOutputViewTest : ShouldCloseViewWithCalculationDataTester + { + private MockRepository mocks; + private MacroStabilityInwardsPlugin plugin; + private ViewInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new MacroStabilityInwardsPlugin(); + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(MacroStabilityInwardsOutputView)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(MacroStabilityInwardsOutputContext), info.DataType); + Assert.AreEqual(typeof(MacroStabilityInwardsCalculationScenario), info.ViewDataType); + TestHelper.AssertImagesAreEqual(Resources.MacroStabilityInwardsInputIcon, info.Image); + } + + [Test] + public void GetViewName_Always_ReturnsInputResourceName() + { + // Setup + using (var view = new MacroStabilityInwardsOutputView()) + { + var calculationScenario = new MacroStabilityInwardsCalculationScenario(); + + // Call + string viewName = info.GetViewName(view, calculationScenario); + + // Assert + Assert.AreEqual("Resultaat", viewName); + } + } + + [Test] + public void GetViewData_Always_ReturnsWrappedCalculation() + { + // Setup + var calculation = new MacroStabilityInwardsCalculationScenario(); + var context = new MacroStabilityInwardsOutputContext(calculation); + + // Call + object viewData = info.GetViewData(context); + + // Assert + Assert.AreSame(calculation, viewData); + mocks.VerifyAll(); + } + + [Test] + public void CreateInstance_Always_CreatesMacroStabilityInwardsOutputView() + { + // Call + IView view = info.CreateInstance(null); + + // Assert + Assert.IsInstanceOf(view); + } + + protected override bool ShouldCloseMethod(IView view, object o) + { + return info.CloseForData(view, o); + } + + protected override IView GetView() + { + return new MacroStabilityInwardsOutputView(); + } + } +} \ No newline at end of file