Index: Core/Plugins/src/Core.Plugins.Chart/ChartPlugin.cs =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/src/Core.Plugins.Chart/ChartPlugin.cs (.../ChartPlugin.cs) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/src/Core.Plugins.Chart/ChartPlugin.cs (.../ChartPlugin.cs) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -63,7 +63,7 @@ public override IEnumerable GetPropertyInfos() { yield return new PropertyInfo(); - yield return new PropertyInfo(); +// yield return new PropertyInfo(); } public override void Dispose() Index: Core/Plugins/src/Core.Plugins.Chart/Core.Plugins.Chart.csproj =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/src/Core.Plugins.Chart/Core.Plugins.Chart.csproj (.../Core.Plugins.Chart.csproj) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/src/Core.Plugins.Chart/Core.Plugins.Chart.csproj (.../Core.Plugins.Chart.csproj) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -76,7 +76,7 @@ Resources.resx - + Index: Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.Designer.cs =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -101,6 +101,24 @@ } /// + /// Looks up a localized string similar to Geeft aan of de gegevensreeks wordt weergegeven.. + /// + public static string ChartDataProperties_IsVisible_Description { + get { + return ResourceManager.GetString("ChartDataProperties_IsVisible_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Weergeven. + /// + public static string ChartDataProperties_IsVisible_DisplayName { + get { + return ResourceManager.GetString("ChartDataProperties_IsVisible_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De naam van deze gegevensreeks.. /// public static string ChartDataProperties_Name_Description { @@ -119,6 +137,24 @@ } /// + /// Looks up a localized string similar to Het type data dat wordt weergegeven in de gegevensreeks.. + /// + public static string ChartDataProperties_Type_Description { + get { + return ResourceManager.GetString("ChartDataProperties_Type_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type. + /// + public static string ChartDataProperties_Type_DisplayName { + get { + return ResourceManager.GetString("ChartDataProperties_Type_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap ChartIcon { Index: Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.resx =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.resx (.../Resources.resx) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/src/Core.Plugins.Chart/Properties/Resources.resx (.../Resources.resx) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -202,4 +202,16 @@ Naam + + Geeft aan of de gegevensreeks wordt weergegeven. + + + Weergeven + + + Het type data dat wordt weergegeven in de gegevensreeks. + + + Type + \ No newline at end of file Fisheye: Tag f7ee6215e886711db4478d524e34718b6df434df refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.Chart/PropertyClasses/ChartDataContextProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/src/Core.Plugins.Chart/PropertyClasses/ChartDataProperties.cs =================================================================== diff -u --- Core/Plugins/src/Core.Plugins.Chart/PropertyClasses/ChartDataProperties.cs (revision 0) +++ Core/Plugins/src/Core.Plugins.Chart/PropertyClasses/ChartDataProperties.cs (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -0,0 +1,70 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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 Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Core.Components.Charting.Data; +using Core.Plugins.Chart.Properties; + +namespace Core.Plugins.Chart.PropertyClasses +{ + public abstract class ChartDataProperties : ObjectProperties + { + private const int namePropertyIndex = 0; + private const int typePropertyIndex = 1; + private const int isVisiblePropertyIndex = 2; + + [PropertyOrder(namePropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ChartDataProperties_Name_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.ChartDataProperties_Name_Description))] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(typePropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ChartDataProperties_Type_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.ChartDataProperties_Type_Description))] + public abstract string Type { get; } + + [PropertyOrder(isVisiblePropertyIndex)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ChartDataProperties_IsVisible_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.ChartDataProperties_IsVisible_Description))] + public bool IsVisible { + get + { + return data.IsVisible; + } + set + { + data.IsVisible = value; + data.NotifyObservers(); + } + } + } +} \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.Chart.Test/ChartPluginTest.cs =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/test/Core.Plugins.Chart.Test/ChartPluginTest.cs (.../ChartPluginTest.cs) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/test/Core.Plugins.Chart.Test/ChartPluginTest.cs (.../ChartPluginTest.cs) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -155,17 +155,12 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(2, propertyInfos.Length); + Assert.AreEqual(1, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, typeof(ChartDataCollection), typeof(ChartDataCollectionProperties)); - - PluginTestHelper.AssertPropertyInfoDefined( - propertyInfos, - typeof(ChartDataContext), - typeof(ChartDataContextProperties)); } } } Index: Core/Plugins/test/Core.Plugins.Chart.Test/Core.Plugins.Chart.Test.csproj =================================================================== diff -u -rff06d226982b6cf8fb15fd087598d2eae377fd21 -rf7ee6215e886711db4478d524e34718b6df434df --- Core/Plugins/test/Core.Plugins.Chart.Test/Core.Plugins.Chart.Test.csproj (.../Core.Plugins.Chart.Test.csproj) (revision ff06d226982b6cf8fb15fd087598d2eae377fd21) +++ Core/Plugins/test/Core.Plugins.Chart.Test/Core.Plugins.Chart.Test.csproj (.../Core.Plugins.Chart.Test.csproj) (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -73,7 +73,7 @@ - + Component Fisheye: Tag f7ee6215e886711db4478d524e34718b6df434df refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.Chart.Test/PropertyClasses/ChartDataContextPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Plugins/test/Core.Plugins.Chart.Test/PropertyClasses/ChartDataPropertiesTest.cs =================================================================== diff -u --- Core/Plugins/test/Core.Plugins.Chart.Test/PropertyClasses/ChartDataPropertiesTest.cs (revision 0) +++ Core/Plugins/test/Core.Plugins.Chart.Test/PropertyClasses/ChartDataPropertiesTest.cs (revision f7ee6215e886711db4478d524e34718b6df434df) @@ -0,0 +1,145 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using Core.Components.Charting.Data; +using Core.Components.Charting.TestUtil; +using Core.Plugins.Chart.PropertyClasses; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Plugins.Chart.Test.PropertyClasses +{ + [TestFixture] + public class ChartDataPropertiesTest + { + private const int namePropertyIndex = 0; + private const int typePropertyIndex = 1; + private const int visiblePropertyIndex = 2; + + [Test] + public void Constructor_ReturnsExpectedValues() + { + // Call + var properties = new TestChartDataProperties(); + + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void Data_SetNewChartDataContextInstance_ReturnCorrectPropertyValues() + { + // Setup + var chartData = new TestChartData("TestChart"); + var properties = new TestChartDataProperties(); + + // Call + properties.Data = chartData; + + // Assert + Assert.AreEqual(chartData.Name, properties.Name); + Assert.AreEqual(chartData.IsVisible, properties.IsVisible); + Assert.AreEqual("Test type string", properties.Type); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + const int numberOfChangedProperties = 1; + + var mocks = new MockRepository(); + var observerMock = mocks.StrictMock(); + observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); + mocks.ReplayAll(); + + var chartData = new TestChartData("Test"); + + chartData.Attach(observerMock); + + var properties = new TestChartDataProperties + { + Data = chartData + }; + + // Call + properties.IsVisible = false; + + // Assert + Assert.IsFalse(chartData.IsVisible); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var chartDataContext = new TestChartData("TestChart"); + + // Call + var properties = new TestChartDataProperties + { + Data = chartDataContext + }; + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van deze gegevensreeks.", + true); + + PropertyDescriptor typeProperty = dynamicProperties[typePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(typeProperty, + generalCategory, + "Type", + "Het type data dat wordt weergegeven in de gegevensreeks.", + true); + + PropertyDescriptor isVisibleProperty = dynamicProperties[visiblePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isVisibleProperty, + generalCategory, + "Weergeven", + "Geeft aan of de gegevensreeks wordt weergegeven."); + } + + private class TestChartDataProperties : ChartDataProperties + { + public override string Type + { + get + { + return "Test type string"; + } + } + } + } +} \ No newline at end of file