Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/GeotechnicalFailureMechanismAssemblyCategoriesContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r24a4dedceab58b48ea5ca0a463a0a7b614e26590 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -65,7 +65,6 @@ - Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/GeotechnicalFailureMechanismAssemblyCategoriesContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r24a4dedceab58b48ea5ca0a463a0a7b614e26590 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 24a4dedceab58b48ea5ca0a463a0a7b614e26590) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -72,7 +72,6 @@ - Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/Ringtoets.Common.Plugin.Test.csproj =================================================================== diff -u -r88a027f5282f504c25327525a3bf2e2e4950b09f -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/Ringtoets.Common.Plugin.Test.csproj (.../Ringtoets.Common.Plugin.Test.csproj) (revision 88a027f5282f504c25327525a3bf2e2e4950b09f) +++ Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/Ringtoets.Common.Plugin.Test.csproj (.../Ringtoets.Common.Plugin.Test.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -46,6 +46,10 @@ {8513B8D6-79C8-4173-B663-59C91AC65E5F} Ringtoets.Common.Plugin + + {4843D6E5-066F-4795-94F5-1D53932DD03C} + Ringtoets.Common.Data.TestUtil + {6346BADF-D331-4948-9772-08E8CD1E1FC9} Ringtoets.Common.Plugin.TestUtil Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs =================================================================== diff -u -r59c178a747bcbd3b5f05f68f6b9b87cfe053047f -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision 59c178a747bcbd3b5f05f68f6b9b87cfe053047f) +++ Ringtoets/Common/test/Ringtoets.Common.Plugin.Test/RingtoetsPluginHelperTest.cs (.../RingtoetsPluginHelperTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -24,6 +24,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Plugin; using Ringtoets.Common.Plugin.TestUtil; @@ -104,6 +105,11 @@ public TestFailureMechanismSectionsView(IFailureMechanism failureMechanism) : base(failureMechanism.Sections, failureMechanism) {} } + + protected override IFailureMechanism GetFailureMechanism() + { + return new TestFailureMechanism(); + } } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs =================================================================== diff -u -r59c178a747bcbd3b5f05f68f6b9b87cfe053047f -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs (.../ShouldCloseViewWithFailureMechanismTester.cs) (revision 59c178a747bcbd3b5f05f68f6b9b87cfe053047f) +++ Ringtoets/Common/test/Ringtoets.Common.Plugin.TestUtil/ShouldCloseViewWithFailureMechanismTester.cs (.../ShouldCloseViewWithFailureMechanismTester.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -45,7 +45,7 @@ assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(Enumerable.Empty()); mocks.ReplayAll(); - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); using (IView view = GetView(failureMechanism)) { @@ -63,7 +63,7 @@ public void ShouldCloseMethod_ViewCorrespondingToRemovedAssessmentSection_ReturnsTrue() { // Setup - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); @@ -89,7 +89,7 @@ public void ShouldCloseMethod_ViewNotCorrespondingToRemovedFailureMechanism_ReturnsFalse() { // Setup - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); using (IView view = GetView(failureMechanism)) { @@ -105,7 +105,7 @@ public void ShouldCloseMethod_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); using (IView view = GetView(failureMechanism)) { @@ -125,7 +125,7 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); var failureMechanismContext = new TestFailureMechanismContext(new TestFailureMechanism(), assessmentSection); using (IView view = GetView(failureMechanism)) @@ -148,7 +148,7 @@ var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - var failureMechanism = new TestFailureMechanism(); + IFailureMechanism failureMechanism = GetFailureMechanism(); var failureMechanismContext = new TestFailureMechanismContext(failureMechanism, assessmentSection); using (IView view = GetView(failureMechanism)) @@ -178,9 +178,15 @@ /// A view object. protected abstract IView GetView(IFailureMechanism failureMechanism); - private class TestFailureMechanismContext : FailureMechanismContext + /// + /// Gets a failure mechanism for testing purposes. + /// + /// An . + protected abstract IFailureMechanism GetFailureMechanism(); + + private class TestFailureMechanismContext : FailureMechanismContext { - public TestFailureMechanismContext(TestFailureMechanism wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism, parent) {} + public TestFailureMechanismContext(IFailureMechanism wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism, parent) {} } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContext.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,58 @@ +// 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 Ringtoets.AssemblyTool.Data; +using Ringtoets.Common.Data.AssemblyTool; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Data.StandAlone; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// This class is a presentation object for failure mechanism category boundaries for a + /// instance. + /// + public class MacroStabilityOutwardsAssemblyCategoriesContext : FailureMechanismAssemblyCategoriesContextBase + { + /// + /// Creates a new instance of . + /// + /// The to wrap. + /// The assessment section the belongs to. + /// The function to get the 'N' parameter used to factor in the 'length effect'. + /// Thrown when any input parameter is null. + public MacroStabilityOutwardsAssemblyCategoriesContext(MacroStabilityOutwardsFailureMechanism wrappedData, + IAssessmentSection assessmentSection, + Func getNFunc) + : base(wrappedData, assessmentSection, getNFunc) + { + GetFailureMechanismSectionAssemblyCategoriesFunc = () => + AssemblyToolCategoriesFactory.CreateGeotechnicalFailureMechanismSectionAssemblyCategories(assessmentSection.FailureMechanismContribution.Norm, + wrappedData.Contribution, + getNFunc()); + } + + public override Func> GetFailureMechanismSectionAssemblyCategoriesFunc { get; } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -44,6 +44,7 @@ + @@ -108,11 +109,11 @@ AssessmentSectionView.cs - + UserControl - - GeotechnicalFailureMechanismAssemblyCategoriesView.cs + + MacroStabilityOutwardsAssemblyCategoriesView.cs UserControl @@ -326,8 +327,8 @@ AssessmentSectionView.cs - - GeotechnicalFailureMechanismAssemblyCategoriesView.cs + + MacroStabilityOutwardsAssemblyCategoriesView.cs FailureMechanismAssemblyCategoriesView.cs Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.resx'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.Designer.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,89 @@ +// 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 Ringtoets.AssemblyTool.Data; + +namespace Ringtoets.Integration.Forms.Views +{ + partial class MacroStabilityOutwardsAssemblyCategoriesView + { + + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.failureMechanismSectionAssemblyCategoriesTable = new Ringtoets.Integration.Forms.Views.AssemblyCategoriesTable(); + this.failureMechanismSectionAssemblyGroupBox = new System.Windows.Forms.GroupBox(); + this.groupBoxPanel = new System.Windows.Forms.Panel(); + this.groupBoxPanel.SuspendLayout(); + this.failureMechanismSectionAssemblyGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // failureMechanismSectionAssemblyCategoriesTable + // + this.failureMechanismSectionAssemblyCategoriesTable.Dock = System.Windows.Forms.DockStyle.Fill; + this.failureMechanismSectionAssemblyCategoriesTable.MultiSelect = true; + this.failureMechanismSectionAssemblyCategoriesTable.Name = "failureMechanismSectionAssemblyCategoriesTable"; + this.failureMechanismSectionAssemblyCategoriesTable.Padding = new System.Windows.Forms.Padding(5); + this.failureMechanismSectionAssemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + // + // groupBoxPanel + // + this.groupBoxPanel.Controls.Add(this.failureMechanismSectionAssemblyGroupBox); + this.groupBoxPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBoxPanel.Name = "groupBoxPanel"; + this.groupBoxPanel.Padding = new System.Windows.Forms.Padding(3); + // + // failureMechanismSectionAssemblyGroupBox + // + this.failureMechanismSectionAssemblyGroupBox.Controls.Add(this.failureMechanismSectionAssemblyCategoriesTable); + this.failureMechanismSectionAssemblyGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.failureMechanismSectionAssemblyGroupBox.Name = "failureMechanismSectionAssemblyGroupBox"; + this.failureMechanismSectionAssemblyGroupBox.Text = global::Ringtoets.Integration.Forms.Properties.Resources.FailureMechanismSectionAssemblyCategories_DisplayName; + // + // FailureMechanismAssemblyCategoriesView + // + this.Controls.Add(this.groupBoxPanel); + this.Name = "MacroStabilityOutwardsAssemblyCategoriesView"; + this.Size = new System.Drawing.Size(750, 420); + this.AutoScrollMinSize = new System.Drawing.Size(400, 100); + this.groupBoxPanel.ResumeLayout(false); + this.failureMechanismSectionAssemblyGroupBox.ResumeLayout(false); + this.ResumeLayout(false); + } + + + #endregion + + private Ringtoets.Integration.Forms.Views.AssemblyCategoriesTable failureMechanismSectionAssemblyCategoriesTable; + private System.Windows.Forms.GroupBox failureMechanismSectionAssemblyGroupBox; + private System.Windows.Forms.Panel groupBoxPanel; + } +} Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,108 @@ +// 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.Base; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.Helpers; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone; + +namespace Ringtoets.Integration.Forms.Views +{ + /// + /// View for a to show + /// its assembly categories. + /// + public partial class MacroStabilityOutwardsAssemblyCategoriesView : CloseForFailureMechanismView + { + private readonly Func> getFailureMechanismSectionAssemblyCategoriesFunc; + private readonly Observer failureMechanismObserver; + private readonly Observer assessmentSectionObserver; + + /// + /// Creates a new instance of . + /// + /// The failure mechanism belonging to the view. + /// The assessment section belonging to the view. + /// The function to get a collection + /// of . + /// Thrown when any parameter is null. + public MacroStabilityOutwardsAssemblyCategoriesView(MacroStabilityOutwardsFailureMechanism failureMechanism, + IAssessmentSection assessmentSection, + Func> getFailureMechanismSectionAssemblyCategoriesFunc) + : base(failureMechanism) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (getFailureMechanismSectionAssemblyCategoriesFunc == null) + { + throw new ArgumentNullException(nameof(getFailureMechanismSectionAssemblyCategoriesFunc)); + } + + this.getFailureMechanismSectionAssemblyCategoriesFunc = getFailureMechanismSectionAssemblyCategoriesFunc; + + InitializeComponent(); + + failureMechanismObserver = new Observer(UpdateTableData) + { + Observable = failureMechanism + }; + + assessmentSectionObserver = new Observer(UpdateTableData) + { + Observable = assessmentSection + }; + + UpdateTableData(); + } + + protected override void Dispose(bool disposing) + { + failureMechanismObserver.Dispose(); + assessmentSectionObserver.Dispose(); + + if (disposing) + { + components?.Dispose(); + } + + base.Dispose(disposing); + } + + private void UpdateTableData() + { + failureMechanismSectionAssemblyCategoriesTable.SetData( + getFailureMechanismSectionAssemblyCategoriesFunc().Select( + category => new Tuple( + category, + AssemblyCategoryGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(category.Group), + category.Group)).ToArray()); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.resx =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.resx (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/MacroStabilityOutwardsAssemblyCategoriesView.resx (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r59c178a747bcbd3b5f05f68f6b9b87cfe053047f -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 59c178a747bcbd3b5f05f68f6b9b87cfe053047f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -624,14 +624,14 @@ context.GetFailureMechanismSectionAssemblyCategoriesFunc) }; - yield return new ViewInfo + yield return new ViewInfo { GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName, Image = RingtoetsCommonFormsResources.NormsIcon, CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView, - CreateInstance = context => new GeotechnicalFailureMechanismAssemblyCategoriesView(context.WrappedData, - context.AssessmentSection, - context.GetFailureMechanismSectionAssemblyCategoriesFunc) + CreateInstance = context => new MacroStabilityOutwardsAssemblyCategoriesView((MacroStabilityOutwardsFailureMechanism) context.WrappedData, + context.AssessmentSection, + context.GetFailureMechanismSectionAssemblyCategoriesFunc) }; } @@ -1079,7 +1079,7 @@ .Build() }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { Text = context => RingtoetsCommonFormsResources.FailureMechanismAssemblyCategories_DisplayName, Image = context => RingtoetsCommonFormsResources.NormsIcon, @@ -1715,9 +1715,9 @@ MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = nodeData.MacroStabilityOutwardsProbabilityAssessmentInput; return new object[] { - new GeotechnicalFailureMechanismAssemblyCategoriesContext(nodeData, - assessmentSection, - () => probabilityAssessmentInput.GetN(probabilityAssessmentInput.SectionLength)), + new MacroStabilityOutwardsAssemblyCategoriesContext(nodeData, + assessmentSection, + () => probabilityAssessmentInput.GetN(probabilityAssessmentInput.SectionLength)), new ProbabilityFailureMechanismSectionResultContext( nodeData.SectionResults, nodeData, assessmentSection), nodeData.OutputComments Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/MacroStabilityOutwardsAssemblyCategoriesContextTest.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,81 @@ +// 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 NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class MacroStabilityOutwardsAssemblyCategoriesContextTest + { + private const double tolerance = 1e-5; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var random = new Random(21); + double n = random.NextDouble(); + + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + Contribution = random.NextDouble() + }; + + var assessmentSection = new AssessmentSectionStub(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator; + + // Call + var context = new MacroStabilityOutwardsAssemblyCategoriesContext(failureMechanism, + assessmentSection, + () => n); + + // Assert + Assert.IsInstanceOf(context); + Assert.AreSame(failureMechanism, context.WrappedData); + Assert.AreSame(assessmentSection, context.AssessmentSection); + + IEnumerable output = context.GetFailureMechanismSectionAssemblyCategoriesFunc(); + IEnumerable calculatorOutput = calculator.GeoTechnicalFailureMechanismSectionCategoriesOutput; + Assert.AreSame(calculatorOutput, output); + + double normativeNorm = assessmentSection.FailureMechanismContribution.Norm; + Assert.AreEqual(failureMechanism.Contribution / 100, calculator.FailureMechanismContribution, tolerance); + Assert.AreEqual(normativeNorm, calculator.NormativeNorm, tolerance); + Assert.AreEqual(n, calculator.FailureMechanismN); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -44,6 +44,7 @@ + @@ -82,7 +83,7 @@ - + Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/GeotechnicalFailureMechanismAssemblyCategoriesViewTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/MacroStabilityOutwardsAssemblyCategoriesViewTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/MacroStabilityOutwardsAssemblyCategoriesViewTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/MacroStabilityOutwardsAssemblyCategoriesViewTest.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,195 @@ +// 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.Linq; +using System.Windows.Forms; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.TestUtil; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.Views; + +namespace Ringtoets.Integration.Forms.Test.Views +{ + [TestFixture] + public class MacroStabilityOutwardsAssemblyCategoriesViewTest + { + [Test] + public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => new MacroStabilityOutwardsAssemblyCategoriesView(failureMechanism, + null, + Enumerable.Empty); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("assessmentSection", paramName); + } + + [Test] + public void Constructor_GetFailureMechanismSectionAssemblyCategoriesFuncNull_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate test = () => new MacroStabilityOutwardsAssemblyCategoriesView(failureMechanism, + assessmentSection, + null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("getFailureMechanismSectionAssemblyCategoriesFunc", paramName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_WithValidParameters_CreatesViewAndTableWithData() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + // Call + using (var view = new MacroStabilityOutwardsAssemblyCategoriesView(failureMechanism, + assessmentSection, + Enumerable.Empty)) + { + // Assert + Assert.IsInstanceOf(view); + Assert.IsNull(view.Data); + Assert.AreEqual(1, view.Controls.Count); + + Panel groupBoxPanel = ControlTestHelper.GetControls(view, "groupBoxPanel").Single(); + Assert.AreEqual(1, groupBoxPanel.Controls.Count); + Assert.AreEqual(DockStyle.Fill, groupBoxPanel.Dock); + + GroupBox failureMechanismSectionAssemblyGroupBox = ControlTestHelper.GetControls(groupBoxPanel, "failureMechanismSectionAssemblyGroupBox").Single(); + Assert.AreEqual(1, failureMechanismSectionAssemblyGroupBox.Controls.Count); + Assert.AreEqual(DockStyle.Fill, failureMechanismSectionAssemblyGroupBox.Dock); + Assert.AreEqual("Categoriegrenzen per vak", failureMechanismSectionAssemblyGroupBox.Text); + + AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view); + Assert.AreEqual(DockStyle.Fill, failureMechanismSectionCategoriesTable.Dock); + } + + mocks.VerifyAll(); + } + + [Test] + public void GivenViewWithValidData_WhenFailureMechanismUpdated_ThenDataTableUpdated() + { + // Given + var random = new Random(21); + + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + + var nrOfCategories = 1; + Func> getFailureMechanismSectionCategories = + () => Enumerable.Repeat(CreateRandomFailureMechanismSectionAssemblyCategory(random), nrOfCategories); + + using (var view = new MacroStabilityOutwardsAssemblyCategoriesView(failureMechanism, + assessmentSection, + getFailureMechanismSectionCategories)) + { + AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view); + + // Precondition + Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count); + + // When + nrOfCategories = 2; + failureMechanism.NotifyObservers(); + + // Then + Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count); + } + + mocks.VerifyAll(); + } + + [Test] + public void GivenViewWithValidData_WhenAssessmentSectionUpdated_ThenDataTableUpdated() + { + // Given + var random = new Random(21); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + var assessmentSection = new AssessmentSectionStub(); + + var nrOfCategories = 1; + Func> getFailureMechanismSectionCategories = + () => Enumerable.Repeat(CreateRandomFailureMechanismSectionAssemblyCategory(random), nrOfCategories); + + using (var view = new MacroStabilityOutwardsAssemblyCategoriesView(failureMechanism, + assessmentSection, + getFailureMechanismSectionCategories)) + { + AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view); + + // Precondition + Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count); + + // When + nrOfCategories = 2; + assessmentSection.NotifyObservers(); + + // Then + Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count); + } + } + + private static FailureMechanismSectionAssemblyCategory CreateRandomFailureMechanismSectionAssemblyCategory(Random random) + { + return new FailureMechanismSectionAssemblyCategory(random.NextDouble(), + random.NextDouble(), + random.NextEnumValue()); + } + + private static AssemblyCategoriesTable GetFailureMechanismSectionCategoriesTable( + MacroStabilityOutwardsAssemblyCategoriesView view) + { + return ControlTestHelper.GetControls>( + view, "failureMechanismSectionAssemblyCategoriesTable").Single(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -105,7 +105,7 @@ - + @@ -145,7 +145,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r1a1e3607cf41c9e963c0ba8fce0885106cb8769f -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 1a1e3607cf41c9e963c0ba8fce0885106cb8769f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -53,6 +53,7 @@ using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.Common.Forms.Views; using Ringtoets.Integration.Data; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; @@ -504,9 +505,9 @@ PluginTestHelper.AssertViewInfoDefined( viewInfos, - typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext), - typeof(IFailureMechanism), - typeof(GeotechnicalFailureMechanismAssemblyCategoriesView)); + typeof(MacroStabilityOutwardsAssemblyCategoriesContext), + typeof(MacroStabilityOutwardsFailureMechanism), + typeof(MacroStabilityOutwardsAssemblyCategoriesView)); } } @@ -557,7 +558,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StructuresOutputContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultTotalContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultPerSectionContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(GeotechnicalFailureMechanismAssemblyCategoriesContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityOutwardsAssemblyCategoriesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismAssemblyCategoriesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssemblyResultsContext))); } Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/GeotechnicalFailureMechanismAssemblyCategoriesContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsAssemblyCategoriesContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsAssemblyCategoriesContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsAssemblyCategoriesContextTreeNodeInfoTest.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,151 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class MacroStabilityOutwardsAssemblyCategoriesContextTreeNodeInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + } + + [Test] + public void Text_Always_ReturnsName() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(null); + + // Assert + Assert.AreEqual("Categoriegrenzen", text); + } + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.NormsIcon, image); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var mocks = new MockRepository(); + + using (var treeView = new TreeViewControl()) + { + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + var assessmentSection = mocks.Stub(); + var context = new MacroStabilityOutwardsAssemblyCategoriesContext(failureMechanism, + assessmentSection, + () => 0); + + var menuBuilder = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilder.Expect(mb => mb.AddOpenItem()).IgnoreArguments().Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + mocks.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, assessmentSection, treeView); + } + + // Assert + mocks.VerifyAll(); + } + } + + private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(MacroStabilityOutwardsAssemblyCategoriesContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -rd68597572782f79b39b7d74844040cec22584b6d -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision d68597572782f79b39b7d74844040cec22584b6d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -42,6 +42,7 @@ using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.Input; using Ringtoets.Integration.Data.StandAlone.SectionResults; +using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -175,7 +176,7 @@ Assert.AreEqual("Oordeel", outputFolder.Name); Assert.AreEqual(TreeFolderCategory.Output, outputFolder.Category); - var failureMechanismAssemblyCategoriesContext = (GeotechnicalFailureMechanismAssemblyCategoriesContext) outputFolder.Contents.ElementAt(0); + var failureMechanismAssemblyCategoriesContext = (MacroStabilityOutwardsAssemblyCategoriesContext) outputFolder.Contents.ElementAt(0); Assert.AreSame(failureMechanism, failureMechanismAssemblyCategoriesContext.WrappedData); Assert.AreSame(assessmentSection, failureMechanismAssemblyCategoriesContext.AssessmentSection); @@ -270,7 +271,7 @@ }; var assessmentSection = mocks.Stub(); var context = new MacroStabilityOutwardsFailureMechanismContext(failureMechanism, assessmentSection); - + using (var treeView = new TreeViewControl()) { var menuBuilder = mocks.StrictMock(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs =================================================================== diff -u -ra5d89a068bbe74f954d1ef57266a39872afc9190 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs (.../FailureMechanismAssemblyCategoriesViewInfoTest.cs) (revision a5d89a068bbe74f954d1ef57266a39872afc9190) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismAssemblyCategoriesViewInfoTest.cs (.../FailureMechanismAssemblyCategoriesViewInfoTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -116,6 +116,11 @@ Enumerable.Empty, Enumerable.Empty); } + + protected override IFailureMechanism GetFailureMechanism() + { + return new TestFailureMechanism(); + } } private class TestFailureMechanismAssemblyCategoriesContext : FailureMechanismAssemblyCategoriesContextBase Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs =================================================================== diff -u -r32994139e33b5ef8110cae9d8a15647c5afa2bc9 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/FailureMechanismSectionsViewInfoTest.cs (.../FailureMechanismSectionsViewInfoTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -110,6 +110,11 @@ { return new FailureMechanismSectionsView(failureMechanism.Sections, failureMechanism); } + + protected override IFailureMechanism GetFailureMechanism() + { + return new TestFailureMechanism(); + } } } } \ No newline at end of file Fisheye: Tag 2da5195c838a61f9b98a178d4add2e93d7c7bfb7 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsAssemblyCategoriesViewInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsAssemblyCategoriesViewInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/MacroStabilityOutwardsAssemblyCategoriesViewInfoTest.cs (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -0,0 +1,124 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Controls.Views; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Plugin.TestUtil; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Views; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.ViewInfos +{ + [TestFixture] + public class MacroStabilityOutwardsAssemblyCategoriesViewInfoTest + { + private static ViewInfo info; + + [SetUp] + public void SetUp() + { + using (var plugin = new RingtoetsPlugin()) + { + info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(MacroStabilityOutwardsAssemblyCategoriesView)); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(MacroStabilityOutwardsAssemblyCategoriesContext), info.DataType); + Assert.AreEqual(typeof(MacroStabilityOutwardsFailureMechanism), info.ViewDataType); + } + + [Test] + public void GetViewName_Always_ReturnsViewName() + { + // Call + string viewName = info.GetViewName(null, null); + + // Assert + Assert.AreEqual("Categoriegrenzen", viewName); + } + + [Test] + public void CreateInstance_WithContext_SetsExpectedViewProperties() + { + // Setup + var assessmentSection = new AssessmentSectionStub(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + var failureMechanismAssemblyCategoriesContext = new MacroStabilityOutwardsAssemblyCategoriesContext(failureMechanism, + assessmentSection, + () => new Random(39).NextDouble()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + var view = (MacroStabilityOutwardsAssemblyCategoriesView) info.CreateInstance(failureMechanismAssemblyCategoriesContext); + + // Assert + Assert.AreSame(failureMechanism, view.FailureMechanism); + } + } + + [Test] + public void Image_Always_ReturnsNormIcon() + { + // Call + Image image = info.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.NormsIcon, image); + } + + [TestFixture] + public class ShouldCloseMacroStabilityOutwardsAssemblyCategoriesViewForDataTester : ShouldCloseViewWithFailureMechanismTester + { + protected override bool ShouldCloseMethod(IView view, object o) + { + return info.CloseForData(view, o); + } + + protected override IView GetView(IFailureMechanism failureMechanism) + { + return new MacroStabilityOutwardsAssemblyCategoriesView((MacroStabilityOutwardsFailureMechanism) failureMechanism, + new AssessmentSectionStub(), + Enumerable.Empty); + } + + protected override IFailureMechanism GetFailureMechanism() + { + return new MacroStabilityOutwardsFailureMechanism(); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs =================================================================== diff -u -r32994139e33b5ef8110cae9d8a15647c5afa2bc9 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/ViewInfos/MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../MacroStabilityInwardsFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -29,6 +29,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Plugin.TestUtil; using Ringtoets.MacroStabilityInwards.Data; @@ -112,6 +113,11 @@ failureMechanism, new MacroStabilityInwardsProbabilityAssessmentInput()); } + protected override IFailureMechanism GetFailureMechanism() + { + return new MacroStabilityInwardsFailureMechanism(); + } + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs =================================================================== diff -u -r32994139e33b5ef8110cae9d8a15647c5afa2bc9 -r2da5195c838a61f9b98a178d4add2e93d7c7bfb7 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 32994139e33b5ef8110cae9d8a15647c5afa2bc9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ViewInfos/PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs (.../PipingFailureMechanismSectionsProbabilityAssessmentViewInfoTest.cs) (revision 2da5195c838a61f9b98a178d4add2e93d7c7bfb7) @@ -112,6 +112,11 @@ failureMechanism, new PipingProbabilityAssessmentInput()); } + + protected override IFailureMechanism GetFailureMechanism() + { + return new PipingFailureMechanism(); + } } } } \ No newline at end of file