Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs =================================================================== diff -u -r73d019534850e1e9592aedbf8f21d7402089ec11 -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 73d019534850e1e9592aedbf8f21d7402089ec11) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/GrassCoverErosionInwardsGuiPluginTest.cs (.../GrassCoverErosionInwardsGuiPluginTest.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -31,6 +31,7 @@ using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; +using Ringtoets.GrassCoverErosionInwards.Forms.Views; namespace Ringtoets.GrassCoverErosionInwards.Plugin.Test { @@ -122,5 +123,34 @@ } mocks.VerifyAll(); } + + [Test] + public void GetViewInfo_ReturnsSupportedViewInfos() + { + // Setup + var mocks = new MockRepository(); + var applicationCore = new ApplicationCore(); + + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.ApplicationCommands).Return(mocks.Stub()); + + guiStub.Stub(g => g.ApplicationCore).Return(applicationCore); + + mocks.ReplayAll(); + + using (var guiPlugin = new GrassCoverErosionInwardsGuiPlugin + { + Gui = guiStub + }) + { + // Call + ViewInfo[] viewInfos = guiPlugin.GetViewInfos().ToArray(); + + // Assert + Assert.AreEqual(1, viewInfos.Length); + + Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(GrassCoverErosionInwardsFailureMechanismResultView))); + } + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj =================================================================== diff -u -r209bfd7b71ef53a57e1a52337f1333d38122282f -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj) (revision 209bfd7b71ef53a57e1a52337f1333d38122282f) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Plugin.Test.csproj) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -47,6 +47,7 @@ + Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -r8f257d2094036e69e5da32dce96b5195f59508ea -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 8f257d2094036e69e5da32dce96b5195f59508ea) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -32,6 +32,9 @@ namespace Ringtoets.HeightStructures.Forms.Views { + /// + /// The view for the . + /// public partial class HeightStructuresFailureMechanismResultView : FailureMechanismResultView { private readonly RecursiveObserver calculationInputObserver; Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r8f257d2094036e69e5da32dce96b5195f59508ea -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 8f257d2094036e69e5da32dce96b5195f59508ea) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -21,15 +21,20 @@ using System; using Core.Common.Base.Data; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.HeightStructures.Data; namespace Ringtoets.HeightStructures.Forms.Views { /// - /// This class represents a row + /// This class represents a row of . /// internal class HeightStructuresFailureMechanismSectionResultRow { + /// + /// Creates a new instance of . + /// + /// The this row contains. public HeightStructuresFailureMechanismSectionResultRow(HeightStructuresFailureMechanismSectionResult sectionResult) { if (sectionResult == null) @@ -39,6 +44,9 @@ SectionResult = sectionResult; } + /// + /// Gets the name of the name. + /// public string Name { get @@ -47,6 +55,9 @@ } } + /// + /// Gets or sets the assessment layer one of the . + /// public bool AssessmentLayerOne { get @@ -60,6 +71,9 @@ } } + /// + /// Gets the assessment layer two a of the . + /// public RoundedDouble AssessmentLayerTwoA { get @@ -68,6 +82,9 @@ } } + /// + /// Gets or sets the assessment layer two b of the . + /// public RoundedDouble AssessmentLayerTwoB { get @@ -80,6 +97,9 @@ } } + /// + /// Gets or sets the assessment layer three of the . + /// public RoundedDouble AssessmentLayerThree { get Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -rb60b7e12cf211bdbe11e0a54734fa097e8ef2146 -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision b60b7e12cf211bdbe11e0a54734fa097e8ef2146) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -22,17 +22,20 @@ using System.Collections; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; using Core.Common.Controls.TreeView; using Core.Common.Gui.Plugin; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.Views; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using HeightStructuresDataResources = Ringtoets.HeightStructures.Data.Properties.Resources; @@ -45,6 +48,22 @@ /// public class HeightStructuresGuiPlugin : GuiPlugin { + public override IEnumerable GetViewInfos() + { + yield return new ViewInfo< + FailureMechanismSectionResultContext, + IEnumerable, + HeightStructuresFailureMechanismResultView + > + { + GetViewName = (v, o) => RingtoetsCommonDataResources.FailureMechanism_AssessmentResult_DisplayName, + Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + CloseForData = CloseFailureMechanismResultViewForData, + GetViewData = context => context.SectionResults, + AfterCreate = (view, context) => view.FailureMechanism = context.FailureMechanism + }; + } + public override IEnumerable GetTreeNodeInfos() { yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( @@ -109,6 +128,29 @@ }; } + #region HeightStructuresFailureMechanismResultView ViewInfo + + private static bool CloseFailureMechanismResultViewForData(HeightStructuresFailureMechanismResultView view, object o) + { + var assessmentSection = o as IAssessmentSection; + var failureMechanism = o as IFailureMechanism; + var failureMechanismContext = o as IFailureMechanismContext; + if (assessmentSection != null) + { + return assessmentSection + .GetFailureMechanisms() + .OfType() + .Any(fm => ReferenceEquals(view.Data, fm.SectionResults)); + } + if (failureMechanismContext != null) + { + failureMechanism = failureMechanismContext.WrappedData; + } + return failureMechanism != null && ReferenceEquals(view.Data, ((HeightStructuresFailureMechanism)failureMechanism).SectionResults); + } + + #endregion + #region HeightStructuresFailureMechanismContext TreeNodeInfo private object[] FailureMechanismEnabledChildNodeObjects(HeightStructuresFailureMechanismContext context) Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs =================================================================== diff -u -re24eab2c6007074685556ec97dbe45940a520687 -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision e24eab2c6007074685556ec97dbe45940a520687) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -28,9 +28,9 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Forms.PresentationObjects; -using Ringtoets.Common.Forms.Views; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.Views; namespace Ringtoets.HeightStructures.Plugin.Test { @@ -82,5 +82,34 @@ mocks.VerifyAll(); } + + [Test] + public void GetViewInfo_ReturnsSupportedViewInfos() + { + // Setup + var mocks = new MockRepository(); + var applicationCore = new ApplicationCore(); + + var guiStub = mocks.Stub(); + guiStub.Stub(g => g.ApplicationCommands).Return(mocks.Stub()); + + guiStub.Stub(g => g.ApplicationCore).Return(applicationCore); + + mocks.ReplayAll(); + + using (var guiPlugin = new HeightStructuresGuiPlugin + { + Gui = guiStub + }) + { + // Call + ViewInfo[] viewInfos = guiPlugin.GetViewInfos().ToArray(); + + // Assert + Assert.AreEqual(1, viewInfos.Length); + + Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(HeightStructuresFailureMechanismResultView))); + } + } } -} +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj =================================================================== diff -u -re24eab2c6007074685556ec97dbe45940a520687 -r3280840f72a6c61740b803385f3af8ec1f6ede91 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision e24eab2c6007074685556ec97dbe45940a520687) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/Ringtoets.HeightStructures.Plugin.Test.csproj (.../Ringtoets.HeightStructures.Plugin.Test.csproj) (revision 3280840f72a6c61740b803385f3af8ec1f6ede91) @@ -47,11 +47,13 @@ + + @@ -76,6 +78,10 @@ {30E4C2AE-719E-4D70-9FA9-668A9767FBFA} Core.Common.Gui + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + {d4200f43-3f72-4f42-af0a-8ced416a38ec} Ringtoets.Common.Data @@ -97,6 +103,7 @@ Ringtoets.HeightStructures.Plugin +