Fisheye: Tag f2c3b3ac67e3549f3a615298376b42ca5bf473c0 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectableTopLevelIllustrationPoint.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPoint.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPoint.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPoint.cs (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -0,0 +1,66 @@ +// 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.Common.Data.IllustrationPoints; + +namespace Ringtoets.Common.Forms.PresentationObjects +{ + /// + /// Class that represents a top level sub mechanism illustration point together + /// with all the calculated closing situations that are present. + /// + public class SelectedTopLevelSubMechanismIllustrationPoint + { + /// + /// Creates a new instance of . + /// + /// The top level sub mechanism illustration point. + /// The closing situations that are present. + /// Thrown when any parameter is null. + public SelectedTopLevelSubMechanismIllustrationPoint(TopLevelSubMechanismIllustrationPoint topLevelSubMechanismIllustrationPoint, + IEnumerable closingSituations) + { + if (topLevelSubMechanismIllustrationPoint == null) + { + throw new ArgumentNullException(nameof(topLevelSubMechanismIllustrationPoint)); + } + if (closingSituations == null) + { + throw new ArgumentNullException(nameof(closingSituations)); + } + + TopLevelSubMechanismIllustrationPoint = topLevelSubMechanismIllustrationPoint; + ClosingSituations = closingSituations; + } + + /// + /// Gets the top level sub mechanism illustration point. + /// + public TopLevelSubMechanismIllustrationPoint TopLevelSubMechanismIllustrationPoint { get; } + + /// + /// Gets the calculated closing situations. + /// + public IEnumerable ClosingSituations { get; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r0247a9558110b4efa96a4b38a8a5cf4bb611d650 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 0247a9558110b4efa96a4b38a8a5cf4bb611d650) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -74,7 +74,7 @@ - + True Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs =================================================================== diff -u -rb682197e586584cc5f29fafe31d6ed185b55e1e7 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision b682197e586584cc5f29fafe31d6ed185b55e1e7) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Views/LocationsView.cs (.../LocationsView.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -25,6 +25,7 @@ using System.Windows.Forms; using Core.Common.Controls.Views; using Core.Common.Utils.Extensions; +using Ringtoets.Common.Data.IllustrationPoints; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.Properties; @@ -191,8 +192,8 @@ { var selection = illustrationPointsControl.Selection as IllustrationPointControlItem; Selection = selection != null - ? new SelectableTopLevelIllustrationPoint(selection.Source, - GetIllustrationPointControlItems().Select(ipci => ipci.ClosingSituation)) + ? new SelectedTopLevelSubMechanismIllustrationPoint((TopLevelSubMechanismIllustrationPoint) selection.Source, + GetIllustrationPointControlItems().Select(ipci => ipci.ClosingSituation)) : null; OnSelectionChanged(); Fisheye: Tag f2c3b3ac67e3549f3a615298376b42ca5bf473c0 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectableTopLevelIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPointTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PresentationObjects/SelectedTopLevelSubMechanismIllustrationPointTest.cs (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -0,0 +1,82 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PresentationObjects; + +namespace Ringtoets.Common.Forms.Test.PresentationObjects +{ + [TestFixture] + public class SelectedTopLevelSubMechanismIllustrationPointTest + { + [Test] + public void Constructor_TopLevelSubMechanismIllustrationPointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SelectedTopLevelSubMechanismIllustrationPoint(null, + Enumerable.Empty()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("topLevelSubMechanismIllustrationPoint", exception.ParamName); + } + + [Test] + public void Constructor_ClosingSituationsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SelectedTopLevelSubMechanismIllustrationPoint(CreateTopLevelSubMechanismIllustrationPoint(), + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("closingSituations", exception.ParamName); + } + + [Test] + public void Constructor_ValidArguments_ReturnsExpectedValues() + { + // Setup + TopLevelSubMechanismIllustrationPoint topLevelSubMechanismIllustrationPoint = CreateTopLevelSubMechanismIllustrationPoint(); + IEnumerable closingSituations = Enumerable.Empty(); + + // Call + var selectedTopLevelSubMechanismIllustrationPoint = new SelectedTopLevelSubMechanismIllustrationPoint(topLevelSubMechanismIllustrationPoint, + closingSituations); + + // Assert + Assert.AreSame(topLevelSubMechanismIllustrationPoint, selectedTopLevelSubMechanismIllustrationPoint.TopLevelSubMechanismIllustrationPoint); + Assert.AreSame(closingSituations, selectedTopLevelSubMechanismIllustrationPoint.ClosingSituations); + } + + private static TopLevelSubMechanismIllustrationPoint CreateTopLevelSubMechanismIllustrationPoint() + { + return new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + "Closing situation", + new TestSubMechanismIllustrationPoint()); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r96fff655a391d41dec6fe60625bfbc009ed1f467 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 96fff655a391d41dec6fe60625bfbc009ed1f467) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -86,7 +86,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/LocationsViewTest.cs =================================================================== diff -u -ra5250b684d0e450832bece4ab7cc4f8cb97755d8 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/LocationsViewTest.cs (.../LocationsViewTest.cs) (revision a5250b684d0e450832bece4ab7cc4f8cb97755d8) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/LocationsViewTest.cs (.../LocationsViewTest.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -188,10 +188,10 @@ object selection = view.Selection; // Then - var selectableTopLevelIllustrationPoint = selection as SelectableTopLevelIllustrationPoint; - Assert.IsNotNull(selectableTopLevelIllustrationPoint); + var selectedTopLevelSubMechanismIllustrationPoint = selection as SelectedTopLevelSubMechanismIllustrationPoint; + Assert.IsNotNull(selectedTopLevelSubMechanismIllustrationPoint); Assert.AreSame(calculatableObject.GeneralResult.TopLevelIllustrationPoints.ElementAt(1), - selectableTopLevelIllustrationPoint.TopLevelIllustrationPoint); + selectedTopLevelSubMechanismIllustrationPoint.TopLevelSubMechanismIllustrationPoint); } [Test] Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r864206280c7a672e3e7d44305e9cffb75a21fe71 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 864206280c7a672e3e7d44305e9cffb75a21fe71) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -324,18 +324,10 @@ { CreateInstance = context => new ForeshoreProfileCollectionProperties(context.WrappedData) }; - yield return new PropertyInfo + yield return new PropertyInfo { - CreateInstance = illustrationPoint => - { - var topLevelIllustrationPoint = illustrationPoint.TopLevelIllustrationPoint as TopLevelSubMechanismIllustrationPoint; - if (topLevelIllustrationPoint != null) - { - return new TopLevelSubMechanismIllustrationPointProperties(topLevelIllustrationPoint, - illustrationPoint.ClosingSituations); - } - return null; - } + CreateInstance = selected => new TopLevelSubMechanismIllustrationPointProperties(selected.TopLevelSubMechanismIllustrationPoint, + selected.ClosingSituations) }; yield return new PropertyInfo { Fisheye: Tag f2c3b3ac67e3549f3a615298376b42ca5bf473c0 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectableTopLevelIllustrationPointPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelSubMechanismIllustrationPointPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelSubMechanismIllustrationPointPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/SelectedTopLevelSubMechanismIllustrationPointPropertyInfoTest.cs (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -0,0 +1,79 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class SelectedTopLevelSubMechanismIllustrationPointPropertyInfoTest + { + private RingtoetsPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new RingtoetsPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(TopLevelSubMechanismIllustrationPointProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(SelectedTopLevelSubMechanismIllustrationPoint), info.DataType); + Assert.AreEqual(typeof(TopLevelSubMechanismIllustrationPointProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_SelectedTopLevelSubMechanismIllustrationPoint_ReturnsTopLevelSubMechanismIllustrationPointProperties() + { + // Setup + var topLevelSubMechanismIllustrationPoint = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), + string.Empty, + new TestSubMechanismIllustrationPoint()); + + var selectedTopLevelSubMechanismIllustrationPoint = new SelectedTopLevelSubMechanismIllustrationPoint(topLevelSubMechanismIllustrationPoint, + Enumerable.Empty()); + + // Call + IObjectProperties objectProperties = info.CreateInstance(selectedTopLevelSubMechanismIllustrationPoint); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(topLevelSubMechanismIllustrationPoint, objectProperties.Data); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r0a8c6f4db5bd26539d8c05d3e0244e656d4720e5 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 0a8c6f4db5bd26539d8c05d3e0244e656d4720e5) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -85,7 +85,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r864206280c7a672e3e7d44305e9cffb75a21fe71 -rf2c3b3ac67e3549f3a615298376b42ca5bf473c0 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 864206280c7a672e3e7d44305e9cffb75a21fe71) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision f2c3b3ac67e3549f3a615298376b42ca5bf473c0) @@ -279,7 +279,7 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, - typeof(SelectableTopLevelIllustrationPoint), + typeof(SelectedTopLevelSubMechanismIllustrationPoint), typeof(TopLevelSubMechanismIllustrationPointProperties)); PluginTestHelper.AssertPropertyInfoDefined(