Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs =================================================================== diff -u -re4c1ee9fe5170ccf7794006d572461d3f88e7740 -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision e4c1ee9fe5170ccf7794006d572461d3f88e7740) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -185,7 +185,7 @@ } if (!stochasticSoilModel.StochasticSoilProfiles.Where(s => s.SoilProfile != null).Sum(s => s.Probability).Equals(1.0)) { - log.WarnFormat("De som van de kans van voorkomen in stochastich ondersgrondmodel '{0}' is niet gelijk aan 1.", stochasticSoilModel.Name); + log.WarnFormat("De som van de kans van voorkomen in het stochastich ondersgrondmodel '{0}' is niet gelijk aan 1.", stochasticSoilModel.Name); } return true; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -rfff5f023c5b150dd71f754b3c13e839596ec19a0 -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision fff5f023c5b150dd71f754b3c13e839596ec19a0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -167,12 +167,13 @@ .Build() }; - yield return new TreeNodeInfo> + yield return new TreeNodeInfo { - Text = pipingSoilProfiles => PipingFormsResources.PipingSoilProfilesCollection_DisplayName, - Image = pipingSoilProfiles => PipingFormsResources.FolderIcon, - ForeColor = pipingSoilProfiles => pipingSoilProfiles.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), - ChildNodeObjects = pipingSoilProfiles => pipingSoilProfiles.Cast().ToArray(), + Text = stochasticSoilModelContext => PipingFormsResources.PipingSoilProfilesCollection_DisplayName, + Image = stochasticSoilModelContext => PipingFormsResources.FolderIcon, + ForeColor = stochasticSoilModelContext => stochasticSoilModelContext.FailureMechanism.StochasticSoilModels.Any() ? + Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), + ChildNodeObjects = stochasticSoilModelContext => stochasticSoilModelContext.FailureMechanism.SoilProfiles.Cast().ToArray(), ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) .AddImportItem() .AddExportItem() @@ -424,7 +425,7 @@ { new FailureMechanismSectionsContext(failureMechanism, assessmentSection), new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection), - failureMechanism.SoilProfiles + new StochasticSoilModelContext(failureMechanism, assessmentSection) }; } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs =================================================================== diff -u -re4c1ee9fe5170ccf7794006d572461d3f88e7740 -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision e4c1ee9fe5170ccf7794006d572461d3f88e7740) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -1,4 +1,25 @@ -using System; +// Copyright (C) Stichting Deltares 2016. 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.Linq; using System.Windows.Forms; using Core.Common.Base; @@ -127,10 +148,9 @@ Assert.AreSame(pipingFailureMechanism, surfaceLinesContext.FailureMechanism); Assert.AreSame(assessmentSection, surfaceLinesContext.AssessmentSection); - CollectionAssert.AreEqual(new object[] - { - pipingFailureMechanism.SoilProfiles - }, inputsFolder.Contents.Cast().Skip(2)); + var stochasticSoilModelContext = (StochasticSoilModelContext) inputsFolder.Contents[2]; + Assert.AreSame(pipingFailureMechanism, stochasticSoilModelContext.FailureMechanism); + Assert.AreSame(assessmentSection, stochasticSoilModelContext.AssessmentSection); var calculationsFolder = (PipingCalculationGroupContext) children[1]; Assert.AreEqual("Berekeningen", calculationsFolder.WrappedData.Name); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs (.../PipingSoilProfileCollectionTreeNodeInfoTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingSoilProfileCollectionTreeNodeInfoTest.cs (.../PipingSoilProfileCollectionTreeNodeInfoTest.cs) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -1,4 +1,25 @@ -using System.Collections.Generic; +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; using System.Drawing; using System.Linq; using Core.Common.Controls.TreeView; @@ -7,7 +28,9 @@ using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data; using Ringtoets.Piping.Data; +using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Plugin; using Ringtoets.Piping.Primitives; @@ -26,14 +49,14 @@ { mocks = new MockRepository(); plugin = new PipingGuiPlugin(); - info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(IEnumerable)); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(StochasticSoilModelContext)); } [Test] public void Initialized_Always_ExpectedPropertiesSet() { // Assert - Assert.AreEqual(typeof(IEnumerable), info.TagType); + Assert.AreEqual(typeof(StochasticSoilModelContext), info.TagType); Assert.IsNull(info.EnsureVisibleOnCreate); Assert.IsNull(info.CanRename); Assert.IsNull(info.OnNodeRenamed); @@ -52,12 +75,13 @@ public void Text_Always_ReturnsTextFromResource() { // Setup - var pipingSoilProfiles = mocks.StrictMock>(); - + var failureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + var stochasticSoilModelContextMock = mocks.StrictMock(failureMechanismMock, assessmentSectionMock); mocks.ReplayAll(); // Call - var text = info.Text(pipingSoilProfiles); + var text = info.Text(stochasticSoilModelContextMock); // Assert Assert.AreEqual(Resources.PipingSoilProfilesCollection_DisplayName, text); @@ -69,12 +93,13 @@ public void Image_Always_ReturnsSetImage() { // Setup - var pipingSoilProfiles = mocks.StrictMock>(); - + var failureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + var stochasticSoilModelContextMock = mocks.StrictMock(failureMechanismMock, assessmentSectionMock); mocks.ReplayAll(); // Call - var image = info.Image(pipingSoilProfiles); + var image = info.Image(stochasticSoilModelContextMock); // Assert TestHelper.AssertImagesAreEqual(Resources.FolderIcon, image); @@ -86,14 +111,13 @@ public void ForeColor_CollectionWithoutSoilProfiles_ReturnsGrayText() { // Setup - var pipingSoilProfiles = mocks.StrictMock>(); - - pipingSoilProfiles.Expect(collection => collection.GetEnumerator()); - + var failureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + var stochasticSoilModelContextMock = mocks.StrictMock(failureMechanismMock, assessmentSectionMock); mocks.ReplayAll(); // Call - var foreColor = info.ForeColor(pipingSoilProfiles); + var foreColor = info.ForeColor(stochasticSoilModelContextMock); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); @@ -105,14 +129,14 @@ public void ForeColor_CollectionWithSoilProfiles_ReturnsControlText() { // Setup - IEnumerable pipingSoilProfiles = new[] - { - new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0), - new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0) - }; + var failureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + var stochasticSoilModelContextMock = mocks.StrictMock(failureMechanismMock, assessmentSectionMock); + failureMechanismMock.StochasticSoilModels.Add(new StochasticSoilModel(0, "Name", "Name")); + mocks.ReplayAll(); // Call - var foreColor = info.ForeColor(pipingSoilProfiles); + var foreColor = info.ForeColor(stochasticSoilModelContextMock); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor); @@ -124,21 +148,43 @@ public void ChildNodeObjects_Always_ReturnsChildsOnData() { // Setup - var pipingSoilProfile1 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0); - var pipingSoilProfile2 = new PipingSoilProfile("", 0, new List { new PipingSoilLayer(10) }, 0); - IEnumerable pipingSoilProfiles = new[] + var pipingSoilProfile1 = new PipingSoilProfile("", 0, new List { - pipingSoilProfile1, - pipingSoilProfile2 + new PipingSoilLayer(10) + }, 0); + var pipingSoilProfile2 = new PipingSoilProfile("", 0, new List + { + new PipingSoilLayer(10) + }, 0); + var stochasticSoilProfile1 = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1) + { + SoilProfile = pipingSoilProfile1 }; + var stochasticSoilProfile2 = new StochasticSoilProfile(1.0, SoilProfileType.SoilProfile1D, 1) + { + SoilProfile = pipingSoilProfile2 + }; + var stochasticSoilModel = new StochasticSoilModel(0, "Name", "Name"); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile1); + stochasticSoilModel.StochasticSoilProfiles.Add(stochasticSoilProfile2); + + var failureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + var stochasticSoilModelContextMock = mocks.StrictMock(failureMechanismMock, assessmentSectionMock); + failureMechanismMock.StochasticSoilModels.Add(stochasticSoilModel); + mocks.ReplayAll(); // Call - var objects = info.ChildNodeObjects(pipingSoilProfiles); + var objects = info.ChildNodeObjects(stochasticSoilModelContextMock); // Assert - CollectionAssert.AreEqual(new[] { pipingSoilProfile1, pipingSoilProfile2 }, objects); + CollectionAssert.AreEqual(new[] + { + pipingSoilProfile1, + pipingSoilProfile2 + }, objects); mocks.VerifyAll(); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -1,20 +1,36 @@ -using System; -using System.Collections.Generic; +// Copyright (C) Stichting Deltares 2016. 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.Linq; using Core.Common.Base.Plugin; using Core.Common.Controls.TreeView; using Core.Common.Gui; using Core.Common.Gui.Commands; using Core.Common.Gui.Plugin; -using Core.Common.TestUtil; using NUnit.Framework; using Rhino.Mocks; - -using Ringtoets.Common.Data; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.PropertyClasses; -using Ringtoets.Piping.Forms.Views; using Ringtoets.Piping.Primitives; using GuiPluginResources = Ringtoets.Piping.Plugin.Properties.Resources; using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources; @@ -124,7 +140,7 @@ Assert.AreEqual(11, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLinesContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLine))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(IEnumerable))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(StochasticSoilModelContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSoilProfile))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingCalculationGroupContext))); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj =================================================================== diff -u -r10779bb6a6db2d00f4627b2bc190e7e35e1fee3e -r2ee142712e588101a958207e041c3e9342e5a7fa --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 10779bb6a6db2d00f4627b2bc190e7e35e1fee3e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 2ee142712e588101a958207e041c3e9342e5a7fa) @@ -133,6 +133,9 @@ + + Copying.licenseheader +