Fisheye: Tag a41b2b6c4947888629521c5a1ca65d405172ecb0 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/BackgroundMapDataContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/BackgroundWmtsMapDataPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/BackgroundWmtsMapDataPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/BackgroundWmtsMapDataPropertyInfoTest.cs (revision a41b2b6c4947888629521c5a1ca65d405172ecb0) @@ -0,0 +1,74 @@ +// 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.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using Core.Components.Gis.Data; +using NUnit.Framework; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class BackgroundWmtsMapDataPropertyInfoTest + { + private RingtoetsPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new RingtoetsPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(BackgroundWmtsMapDataProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(BackgroundMapDataContext), info.DataType); + Assert.AreEqual(typeof(BackgroundWmtsMapDataProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_Always_NewPropertiesWithInputContextAsData() + { + // Setup + WmtsMapData mapData = WmtsMapData.CreateUnconnectedMapData(); + var context = new BackgroundMapDataContext(mapData); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(mapData, objectProperties.Data); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -rbfec53f54638017ab175196f69b24d06d118f170 -ra41b2b6c4947888629521c5a1ca65d405172ecb0 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision bfec53f54638017ab175196f69b24d06d118f170) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision a41b2b6c4947888629521c5a1ca65d405172ecb0) @@ -87,14 +87,14 @@ - + - + Fisheye: Tag a41b2b6c4947888629521c5a1ca65d405172ecb0 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundMapDataContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundWmtsMapDataTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundWmtsMapDataTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/BackgroundWmtsMapDataTreeNodeInfoTest.cs (revision a41b2b6c4947888629521c5a1ca65d405172ecb0) @@ -0,0 +1,145 @@ +// 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.Drawing; +using System.Linq; +using Core.Common.Controls.TreeView; +using Core.Common.TestUtil; +using Core.Components.Gis.Data; +using NUnit.Framework; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.Properties; + +namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class BackgroundWmtsMapDataTreeNodeInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNull(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 + WmtsMapData mapData = WmtsMapData.CreateUnconnectedMapData(); + var context = new BackgroundMapDataContext(mapData); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(context); + + // Assert + Assert.AreEqual("Achtergrondkaart", text); + } + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + WmtsMapData mapData = WmtsMapData.CreateUnconnectedMapData(); + var context = new BackgroundMapDataContext(mapData); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(context); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.Map, image); + } + } + + [Test] + public void ForeColor_ConnectedMapData_ReturnControlText() + { + WmtsMapData mapData = WmtsMapData.CreateDefaultPdokMapData(); + var context = new BackgroundMapDataContext(mapData); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Color image = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), image); + } + } + + [Test] + public void ForeColor_UnconnectedMapData_ReturnControlText() + { + WmtsMapData mapData = WmtsMapData.CreateUnconnectedMapData(); + var context = new BackgroundMapDataContext(mapData); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Color image = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), image); + } + } + + private TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(BackgroundMapDataContext)); + } + } +} \ No newline at end of file