Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -113,7 +113,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new ClosingStructuresFailureMechanismResultView( context.AssessmentSection, - ((ClosingStructuresFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -re1a93747d105f27392f4bc0655694810c7d29f4d -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Plugin.Test/TreeNodeInfos/ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../ClosingStructuresProbabilityFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -21,6 +21,7 @@ using System.Drawing; using System.Linq; +using Core.Common.Base; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; @@ -115,10 +116,11 @@ { var failureMechanism = new ClosingStructuresFailureMechanism(); var sectionResult = new StructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); - var sectionResultContext = new ProbabilityFailureMechanismSectionResultContext>(new[] - { - sectionResult - }, failureMechanism, assessmentSection); + var sectionResultContext = new ProbabilityFailureMechanismSectionResultContext>( + new ObservableList> + { + sectionResult + }, failureMechanism, assessmentSection); var gui = mockRepository.Stub(); gui.Stub(g => g.Get(sectionResultContext, treeViewControl)).Return(menuBuilder); Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs =================================================================== diff -u -rf1c2db8c066ce430155473bfb57ccfaccb64c035 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision f1c2db8c066ce430155473bfb57ccfaccb64c035) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/FailureMechanismSectionResultContext.cs (.../FailureMechanismSectionResultContext.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; +using Core.Common.Base; using Core.Common.Controls.PresentationObjects; using Ringtoets.Common.Data.FailureMechanism; @@ -30,15 +30,15 @@ /// This class is a presentation object for a collection of . /// /// The type of . - public class FailureMechanismSectionResultContext : WrappedObjectContextBase> where T : FailureMechanismSectionResult + public class FailureMechanismSectionResultContext : WrappedObjectContextBase> where T : FailureMechanismSectionResult { /// /// Creates a new instance of . /// - /// The of to wrap. + /// The of to wrap. /// The the belongs to. /// Thrown when any input argument is null. - public FailureMechanismSectionResultContext(IEnumerable wrappedSectionResults, IFailureMechanism failureMechanism) + public FailureMechanismSectionResultContext(IObservableEnumerable wrappedSectionResults, IFailureMechanism failureMechanism) : base(wrappedSectionResults) { if (failureMechanism == null) Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ProbabilityFailureMechanismSectionResultContext.cs =================================================================== diff -u -raee2e55bc9dbf0bbe1fac86898575c7faa33162c -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ProbabilityFailureMechanismSectionResultContext.cs (.../ProbabilityFailureMechanismSectionResultContext.cs) (revision aee2e55bc9dbf0bbe1fac86898575c7faa33162c) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ProbabilityFailureMechanismSectionResultContext.cs (.../ProbabilityFailureMechanismSectionResultContext.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; +using Core.Common.Base; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; @@ -35,11 +35,11 @@ /// /// Creates a new instance of . /// - /// The of to wrap. + /// The of to wrap. /// The the belongs to. /// The assessment section the section results belongs to. /// Thrown when any parameter is null. - public ProbabilityFailureMechanismSectionResultContext(IEnumerable wrappedSectionResults, IFailureMechanism failureMechanism, + public ProbabilityFailureMechanismSectionResultContext(IObservableEnumerable wrappedSectionResults, IFailureMechanism failureMechanism, IAssessmentSection assessmentSection) : base(wrappedSectionResults, failureMechanism) { Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/FailureMechanismSectionResultContextTest.cs (.../FailureMechanismSectionResultContextTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -20,7 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; +using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.Controls.PresentationObjects; using NUnit.Framework; @@ -42,7 +42,7 @@ var failureMechanism = mocks.Stub(); mocks.ReplayAll(); - var failureMechanismSectionResults = new[] + var failureMechanismSectionResults = new ObservableList { CreateFailureMechanismSectionResult() }; @@ -51,7 +51,7 @@ var context = new FailureMechanismSectionResultContext(failureMechanismSectionResults, failureMechanism); // Assert - Assert.IsInstanceOf>>(context); + Assert.IsInstanceOf>>(context); Assert.AreSame(failureMechanismSectionResults, context.WrappedData); Assert.AreSame(failureMechanism, context.FailureMechanism); mocks.VerifyAll(); @@ -64,10 +64,11 @@ FailureMechanismSectionResult sectionResult = CreateFailureMechanismSectionResult(); // Call - TestDelegate call = () => new FailureMechanismSectionResultContext(new[] - { - sectionResult - }, null); + TestDelegate call = () => new FailureMechanismSectionResultContext( + new ObservableList + { + sectionResult + }, null); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs =================================================================== diff -u -rf1c2db8c066ce430155473bfb57ccfaccb64c035 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs (.../ProbabilityFailureMechanismSectionResultContextTest.cs) (revision f1c2db8c066ce430155473bfb57ccfaccb64c035) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs (.../ProbabilityFailureMechanismSectionResultContextTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -20,8 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; -using System.Linq; +using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -38,8 +37,8 @@ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new ProbabilityFailureMechanismSectionResultContext(Enumerable.Empty(), - new TestFailureMechanism(), null); + TestDelegate call = () => new ProbabilityFailureMechanismSectionResultContext( + new ObservableList(), new TestFailureMechanism(), null); // Assert var exception = Assert.Throws(call); @@ -54,7 +53,7 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - IEnumerable sectionResults = Enumerable.Empty(); + IObservableEnumerable sectionResults = new ObservableList(); var failureMechanism = new TestFailureMechanism(); // Call Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs =================================================================== diff -u -r16ff9b6edce7916571518d621021b2995c1c01aa -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 16ff9b6edce7916571518d621021b2995c1c01aa) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -110,7 +110,8 @@ Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, - AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, + CreateInstance = context => new DuneErosionFailureMechanismResultView(context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ViewInfos/DuneErosionFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ViewInfos/DuneErosionFailureMechanismResultViewInfoTest.cs (.../DuneErosionFailureMechanismResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ViewInfos/DuneErosionFailureMechanismResultViewInfoTest.cs (.../DuneErosionFailureMechanismResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -201,7 +201,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new GrassCoverErosionInwardsFailureMechanismResultView( context.AssessmentSection, - ((GrassCoverErosionInwardsFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ViewInfos/GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; +using Core.Common.Base; using Core.Common.Controls.Views; using Core.Common.Gui.Plugin; using Core.Common.TestUtil; @@ -83,7 +84,7 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var sectionResults = new[] + var sectionResults = new ObservableList { new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) }; Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -rbbb17c2543d152e7567251a0432d59b4db72f33b -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision bbb17c2543d152e7567251a0432d59b4db72f33b) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -143,7 +143,8 @@ Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, - AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, + CreateInstance = context => new GrassCoverErosionOutwardsFailureMechanismResultView(context.WrappedData) }; yield return new ViewInfo< @@ -330,6 +331,11 @@ hydraulicBoundaryLocationCalculationGuiService = new HydraulicBoundaryLocationCalculationGuiService(Gui.MainWindow); } + private static RoundedDouble GetAssessmentLevel(ICalculation calculation) + { + return calculation.InputParameters.HydraulicBoundaryLocation?.DesignWaterLevelCalculation1.Output?.Result ?? RoundedDouble.NaN; + } + #region ViewInfos #region GrassCoverErosionOutwardsFailureMechanismView ViewInfo @@ -960,10 +966,5 @@ } #endregion - - private static RoundedDouble GetAssessmentLevel(ICalculation calculation) - { - return calculation.InputParameters.HydraulicBoundaryLocation?.DesignWaterLevelCalculation1.Output?.Result ?? RoundedDouble.NaN; - } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj =================================================================== diff -u -rc840995eaf5d4c4564b7edfa56d964ea55ebbec0 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision c840995eaf5d4c4564b7edfa56d964ea55ebbec0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -51,6 +51,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismResultViewInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismResultViewInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsFailureMechanismResultViewInfoTest.cs (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -0,0 +1,342 @@ +// 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.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; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Forms.Views; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.ViewInfos +{ + [TestFixture] + public class GrassCoverErosionOutwardsResultViewInfoTest + { + private MockRepository mocks; + private GrassCoverErosionOutwardsPlugin plugin; + private ViewInfo info; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new GrassCoverErosionOutwardsPlugin(); + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(GrassCoverErosionOutwardsFailureMechanismResultView)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), info.DataType); + Assert.AreEqual(typeof(IEnumerable), info.ViewDataType); + } + + [Test] + public void GetViewData_Always_ReturnsWrappedFailureMechanismResult() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism); + + // Call + object viewData = info.GetViewData(context); + + // Assert + Assert.AreSame(failureMechanism.SectionResults, viewData); + } + + [Test] + public void GetViewName_Always_ReturnsViewName() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + // Call + string viewName = info.GetViewName(view, failureMechanism.SectionResults); + + // Assert + Assert.AreEqual("Resultaat", viewName); + } + } + + [Test] + public void ViewType_Always_ReturnsViewType() + { + // Call + Type viewType = info.ViewType; + + // Assert + Assert.AreEqual(typeof(GrassCoverErosionOutwardsFailureMechanismResultView), viewType); + } + + [Test] + public void DataType_Always_ReturnsDataType() + { + // Call + Type dataType = info.DataType; + + // Assert + Assert.AreEqual(typeof(FailureMechanismSectionResultContext), dataType); + } + + [Test] + public void ViewDataType_Always_ReturnsViewDataType() + { + // Call + Type viewDataType = info.ViewDataType; + + // Assert + Assert.AreEqual(typeof(IEnumerable), viewDataType); + } + + [Test] + public void Image_Always_ReturnsGenericInputOutputIcon() + { + // Call + Image image = info.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, image); + } + + [Test] + public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse() + { + // Setup + var assessmentSection = mocks.Stub(); + assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[0]); + mocks.ReplayAll(); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsFalse(closeForData); + } + + mocks.VerifyAll(); + } + + [Test] + public void CloseForData_ViewNotCorrespondingToRemovedAssessmentSection_ReturnsFalse() + { + // Setup + var assessmentSection = mocks.Stub(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var otherFailureMechanism = mocks.Stub("N", "C"); + + assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new[] + { + otherFailureMechanism + }); + + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsFalse(closeForData); + } + + mocks.VerifyAll(); + } + + [Test] + public void CloseForData_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() + { + // Setup + var assessmentSection = mocks.Stub(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(new IFailureMechanism[] + { + new GrassCoverErosionOutwardsFailureMechanism(), + failureMechanism + }); + + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, assessmentSection); + + // Assert + Assert.IsTrue(closeForData); + } + + mocks.VerifyAll(); + } + + [Test] + public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, failureMechanism); + + // Assert + Assert.IsTrue(closeForData); + } + } + + [Test] + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, new GrassCoverErosionOutwardsFailureMechanism()); + + // Assert + Assert.IsFalse(closeForData); + } + } + + [Test] + public void CloseForData_ViewCorrespondingToRemovedFailureMechanismContext_ReturnsTrue() + { + // Setup + var assessmentSection = mocks.Stub(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(failureMechanism, + assessmentSection); + + mocks.ReplayAll(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsTrue(closeForData); + } + + mocks.VerifyAll(); + } + + [Test] + public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() + { + // Setup + var assessmentSection = mocks.Stub(); + var failureMechanismContext = new GrassCoverErosionOutwardsFailureMechanismContext(new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection); + mocks.ReplayAll(); + + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + using (var view = new GrassCoverErosionOutwardsFailureMechanismResultView(failureMechanism.SectionResults)) + { + view.Data = failureMechanism.SectionResults; + + // Call + bool closeForData = info.CloseForData(view, failureMechanismContext); + + // Assert + Assert.IsFalse(closeForData); + } + + mocks.VerifyAll(); + } + + [Test] + public void AfterCreate_Always_SetsSpecificPropertiesToView() + { + // Setup + var view = mocks.StrictMock(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext(failureMechanism.SectionResults, failureMechanism); + + view.Expect(v => v.FailureMechanism = failureMechanism); + + mocks.ReplayAll(); + + // Call + info.AfterCreate(view, context); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -185,7 +185,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new HeightStructuresFailureMechanismResultView( context.AssessmentSection, - ((HeightStructuresFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs =================================================================== diff -u -re1a93747d105f27392f4bc0655694810c7d29f4d -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs (.../HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs) (revision e1a93747d105f27392f4bc0655694810c7d29f4d) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/TreeNodeInfos/HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs (.../HeightStructuresProbabilityFailureMechanismResultContextTreeNodeInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -21,6 +21,7 @@ using System.Drawing; using System.Linq; +using Core.Common.Base; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.ContextMenu; @@ -124,7 +125,7 @@ var failureMechanism = new HeightStructuresFailureMechanism(); var context = new ProbabilityFailureMechanismSectionResultContext>( - Enumerable.Empty>(), failureMechanism, assessmentSection); + new ObservableList>(), failureMechanism, assessmentSection); using (var treeViewControl = new TreeViewControl()) { @@ -138,6 +139,7 @@ // Call info.ContextMenuStrip(context, null, treeViewControl); } + // Assert // Assert expectancies are called in TearDown() } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs (.../HeightStructuresFailureMechanismResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/ViewInfos/HeightStructuresFailureMechanismResultViewInfoTest.cs (.../HeightStructuresFailureMechanismResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; +using Core.Common.Base; using Core.Common.Controls.Views; using Core.Common.Gui.Plugin; using Core.Common.TestUtil; @@ -84,7 +85,7 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var sectionResults = new[] + var sectionResults = new ObservableList> { new StructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) }; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r421cbbc8a7149960b5e6908bde1744c63e4d1169 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 421cbbc8a7149960b5e6908bde1744c63e4d1169) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -436,28 +436,43 @@ yield return CreateFailureMechanismResultViewInfo< GrassCoverSlipOffInwardsFailureMechanismSectionResult, - GrassCoverSlipOffInwardsResultView>(); + GrassCoverSlipOffInwardsResultView>( + context => new GrassCoverSlipOffInwardsResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< GrassCoverSlipOffOutwardsFailureMechanismSectionResult, - GrassCoverSlipOffOutwardsResultView>(); + GrassCoverSlipOffOutwardsResultView>( + context => new GrassCoverSlipOffOutwardsResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< MicrostabilityFailureMechanismSectionResult, - MicrostabilityResultView>(); + MicrostabilityResultView>( + context => new MicrostabilityResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< PipingStructureFailureMechanismSectionResult, - PipingStructureResultView>(); + PipingStructureResultView>( + context => new PipingStructureResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< TechnicalInnovationFailureMechanismSectionResult, - TechnicalInnovationResultView>(); + TechnicalInnovationResultView>( + context => new TechnicalInnovationResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult, - StrengthStabilityLengthwiseConstructionResultView>(); + StrengthStabilityLengthwiseConstructionResultView>( + context => new StrengthStabilityLengthwiseConstructionResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< WaterPressureAsphaltCoverFailureMechanismSectionResult, - WaterPressureAsphaltCoverResultView>(); + WaterPressureAsphaltCoverResultView>( + context => new WaterPressureAsphaltCoverResultView(context.WrappedData)); + yield return CreateFailureMechanismResultViewInfo< MacroStabilityOutwardsFailureMechanismSectionResult, - MacroStabilityOutwardsResultView>(); + MacroStabilityOutwardsResultView>( + context => new MacroStabilityOutwardsResultView(context.WrappedData)); yield return new ViewInfo { @@ -844,7 +859,8 @@ }; } - private static ViewInfo, IEnumerable, TView> CreateFailureMechanismResultViewInfo() + private static ViewInfo, IEnumerable, TView> CreateFailureMechanismResultViewInfo( + Func, TView> createInstanceFunc) where TResult : FailureMechanismSectionResult where TView : FailureMechanismResultView { @@ -857,7 +873,8 @@ Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, - AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, + CreateInstance = createInstanceFunc }; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsResultViewInfoTest.cs (.../GrassCoverSlipOffInwardsResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffInwardsResultViewInfoTest.cs (.../GrassCoverSlipOffInwardsResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsResultViewInfoTest.cs (.../GrassCoverSlipOffOutwardsResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GrassCoverSlipOffOutwardsResultViewInfoTest.cs (.../GrassCoverSlipOffOutwardsResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs (.../MacroStabilityOutwardsResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsResultViewInfoTest.cs (.../MacroStabilityOutwardsResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -322,5 +323,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MicrostabilityResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MicrostabilityResultViewInfoTest.cs (.../MicrostabilityResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MicrostabilityResultViewInfoTest.cs (.../MicrostabilityResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/PipingStructureResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/PipingStructureResultViewInfoTest.cs (.../PipingStructureResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/PipingStructureResultViewInfoTest.cs (.../PipingStructureResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StrengthStabilityLengthwiseConstructionResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StrengthStabilityLengthwiseConstructionResultViewInfoTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/StrengthStabilityLengthwiseConstructionResultViewInfoTest.cs (.../StrengthStabilityLengthwiseConstructionResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -320,5 +321,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/TechnicalInnovationResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/TechnicalInnovationResultViewInfoTest.cs (.../TechnicalInnovationResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/TechnicalInnovationResultViewInfoTest.cs (.../TechnicalInnovationResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -318,5 +319,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverResultViewInfoTest.cs (.../WaterPressureAsphaltCoverResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/WaterPressureAsphaltCoverResultViewInfoTest.cs (.../WaterPressureAsphaltCoverResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -320,5 +321,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -224,7 +224,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new MacroStabilityInwardsFailureMechanismResultView( context.AssessmentSection, - ((MacroStabilityInwardsFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs =================================================================== diff -u -r5b421f80047c5b98776fb1c6f4a216775066e805 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs (.../ProbabilityFailureMechanismSectionResultContextTest.cs) (revision 5b421f80047c5b98776fb1c6f4a216775066e805) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PresentationObjects/ProbabilityFailureMechanismSectionResultContextTest.cs (.../ProbabilityFailureMechanismSectionResultContextTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -20,8 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; -using System.Linq; +using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -37,8 +36,8 @@ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new ProbabilityFailureMechanismSectionResultContext(Enumerable.Empty(), - new MacroStabilityInwardsFailureMechanism(), null); + TestDelegate call = () => new ProbabilityFailureMechanismSectionResultContext( + new ObservableList(), new MacroStabilityInwardsFailureMechanism(), null); // Assert var exception = Assert.Throws(call); @@ -53,11 +52,13 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - IEnumerable sectionResults = Enumerable.Empty(); + IObservableEnumerable sectionResults = + new ObservableList(); var failureMechanism = new MacroStabilityInwardsFailureMechanism(); // Call - var context = new ProbabilityFailureMechanismSectionResultContext (sectionResults, failureMechanism, assessmentSection); + var context = new ProbabilityFailureMechanismSectionResultContext( + sectionResults, failureMechanism, assessmentSection); // Assert Assert.IsInstanceOf>(context); Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -219,7 +219,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new PipingFailureMechanismResultView( context.AssessmentSection, - ((PipingFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -111,7 +111,7 @@ AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, CreateInstance = context => new StabilityPointStructuresFailureMechanismResultView( context.AssessmentSection, - ((StabilityPointStructuresFailureMechanism) context.FailureMechanism).SectionResults) + context.WrappedData) }; yield return new ViewInfo Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -rbbb17c2543d152e7567251a0432d59b4db72f33b -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision bbb17c2543d152e7567251a0432d59b4db72f33b) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -31,6 +31,7 @@ using Core.Common.Util; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Forms; using Ringtoets.Common.Forms.ChangeHandlers; @@ -92,7 +93,8 @@ Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, - AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, + CreateInstance = context => new StabilityStoneCoverResultView(context.WrappedData) }; } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs =================================================================== diff -u -r3178e116f5e59e03078d465efeb303c5e232c7bf -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision 3178e116f5e59e03078d465efeb303c5e232c7bf) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs (.../StabilityStoneCoverFailureMechanismSectionResultContextTreeNodeInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -21,6 +21,7 @@ using System.Drawing; using System.Linq; +using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.Controls.TreeView; using Core.Common.Gui; @@ -124,10 +125,11 @@ new Point2D(0, 0) }); var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(section); - var sectionResultContext = new FailureMechanismSectionResultContext(new[] - { - sectionResult - }, failureMechanism); + var sectionResultContext = new FailureMechanismSectionResultContext( + new ObservableList + { + sectionResult + }, failureMechanism); var menuBuilder = mocks.StrictMock(); menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); @@ -145,6 +147,7 @@ // Call info.ContextMenuStrip(sectionResultContext, null, treeViewControl); } + // Assert // Assert expectancies are called in TearDown() } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverResultViewInfoTest.cs (.../StabilityStoneCoverResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ViewInfos/StabilityStoneCoverResultViewInfoTest.cs (.../StabilityStoneCoverResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,12 +23,15 @@ 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; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.StabilityStoneCover.Data; using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; @@ -319,5 +322,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs =================================================================== diff -u -rbbb17c2543d152e7567251a0432d59b4db72f33b -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision bbb17c2543d152e7567251a0432d59b4db72f33b) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -92,7 +92,8 @@ Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, CloseForData = CloseFailureMechanismResultViewForData, GetViewData = context => context.WrappedData, - AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism, + CreateInstance = context => new WaveImpactAsphaltCoverFailureMechanismResultView(context.WrappedData) }; } Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverResultViewInfoTest.cs =================================================================== diff -u -r94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4 -rf603458169b1e2544bc933b05f169cc1637d59b2 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverResultViewInfoTest.cs (.../WaveImpactAsphaltCoverResultViewInfoTest.cs) (revision 94f68f51cd9b8fd8c0c162cf874ef7e4580b0ee4) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ViewInfos/WaveImpactAsphaltCoverResultViewInfoTest.cs (.../WaveImpactAsphaltCoverResultViewInfoTest.cs) (revision f603458169b1e2544bc933b05f169cc1637d59b2) @@ -23,6 +23,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; @@ -155,6 +156,7 @@ // Assert Assert.IsFalse(closeForData); } + mocks.VerifyAll(); } @@ -183,6 +185,7 @@ // Assert Assert.IsFalse(closeForData); } + mocks.VerifyAll(); } @@ -211,6 +214,7 @@ // Assert Assert.IsTrue(closeForData); } + mocks.VerifyAll(); } @@ -271,6 +275,7 @@ // Assert Assert.IsTrue(closeForData); } + mocks.VerifyAll(); } @@ -295,6 +300,7 @@ // Assert Assert.IsFalse(closeForData); } + mocks.VerifyAll(); } @@ -316,5 +322,21 @@ // Assert mocks.VerifyAll(); } + + [Test] + public void CreateInstance_Always_ReturnsView() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + var context = new FailureMechanismSectionResultContext( + failureMechanism.SectionResults, + failureMechanism); + + // Call + IView view = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(view); + } } } \ No newline at end of file