Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenPointedTreeGraphViewCommand.cs =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenPointedTreeGraphViewCommand.cs (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenPointedTreeGraphViewCommand.cs (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -0,0 +1,64 @@ +// 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 Core.Common.Controls.Commands; +using Core.Common.Gui.Commands; +using Core.Components.PointedTree.Data; + +namespace Demo.Ringtoets.Commands +{ + /// + /// This class describes the command for opening a view for with some arbitrary data. + /// + public class OpenPointedTreeGraphViewCommand : ICommand + { + private readonly IViewCommands viewCommands; + + /// + /// Creates a new instance of . + /// + /// The to use internally. + public OpenPointedTreeGraphViewCommand(IViewCommands viewCommands) + { + this.viewCommands = viewCommands; + } + + public bool Checked + { + get + { + return false; + } + } + + public void Execute() + { + var data = new GraphNode("Root node", new [] + { + new GraphNode("First", new GraphNode[0], false), + new GraphNode("Second", new GraphNode[0], true), + }, false, new GraphNodeStyle(GraphNodeShape.Diamond, Color.LightBlue, Color.DarkBlue, 3)); + + viewCommands.OpenView(data); + } + } +} \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/Demo.Ringtoets.csproj (.../Demo.Ringtoets.csproj) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -54,6 +54,7 @@ + @@ -77,6 +78,12 @@ MapDataView.cs + + UserControl + + + PointedTreeGraphView.cs + UserControl @@ -130,11 +137,26 @@ Core.Components.Gis False + + {4e575459-ad64-4f5f-b313-9f8e0ec8c03f} + Core.Components.GraphSharp.Forms + False + {DADAA0A5-288C-49CB-9F08-337F16832C86} Core.Components.OxyPlot.Forms False + + {dbf5a590-2a11-4eb4-a8cc-f3036475e4d5} + Core.Components.PointedTree.Forms + False + + + {ad3b1634-c435-4618-9971-2ea0817f5de2} + Core.Components.PointedTree + False + {72109e33-6518-4632-accf-6cbf2a312711} Core.Components.Stack.Forms @@ -235,6 +257,9 @@ MapDataView.cs + + PointedTreeGraphView.cs + StackChartDataView.cs @@ -276,6 +301,7 @@ + Index: Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs (.../DemoProjectPlugin.cs) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/GUIs/DemoProjectPlugin.cs (.../DemoProjectPlugin.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -24,7 +24,9 @@ using Core.Common.Gui.Plugin; using Core.Components.Chart.Data; using Core.Components.Gis.Data; +using Core.Components.PointedTree.Data; using Core.Components.Stack.Data; +using Demo.Ringtoets.Properties; using Demo.Ringtoets.Ribbons; using Demo.Ringtoets.Views; using ChartResources = Core.Plugins.Chart.Properties.Resources; @@ -64,6 +66,12 @@ Image = CoreCommonGuiResources.DocumentHS, GetViewName = (v, o) => ChartResources.OxyPlotPlugin_GetViewInfos_Diagram }; + + yield return new ViewInfo + { + Image = Resources.FaultTreeIcon, + GetViewName = (v, o) => Resources.General_FaultTree + }; } } } \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -140,6 +140,16 @@ /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// + public static System.Drawing.Bitmap FaultTreeIcon { + get { + object obj = ResourceManager.GetObject("FaultTreeIcon", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// public static System.Drawing.Bitmap FolderIcon { get { object obj = ResourceManager.GetObject("FolderIcon", resourceCulture); @@ -167,6 +177,15 @@ } /// + /// Looks up a localized string similar to Foutenboom. + /// + public static string General_FaultTree { + get { + return ResourceManager.GetString("General_FaultTree", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kaart. /// public static string General_Map { @@ -258,6 +277,15 @@ } /// + /// Looks up a localized string similar to Open een documentvenster met een foutenboom.. + /// + public static string OpenFaultTree_ToolTip { + get { + return ResourceManager.GetString("OpenFaultTree_ToolTip", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Open een documentvenster met een kaart.. /// public static string OpenMapView_ToolTip { Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -208,4 +208,13 @@ Kolom grafiek + + Foutenboom + + + Open een documentvenster met een foutenboom. + + + ..\Resources\chart_organisation.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Resources/chart_organisation.png =================================================================== diff -u Binary files differ Index: Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml (.../RingtoetsDemoProjectRibbon.xaml) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml (.../RingtoetsDemoProjectRibbon.xaml) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -49,9 +49,12 @@ - - + + + + + Index: Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml.cs =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml.cs (.../RingtoetsDemoProjectRibbon.xaml.cs) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/src/Demo.Ringtoets/Ribbons/RingtoetsDemoProjectRibbon.xaml.cs (.../RingtoetsDemoProjectRibbon.xaml.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -34,7 +34,7 @@ /// public partial class RingtoetsDemoProjectRibbon : IRibbonCommandHandler { - private readonly ICommand addNewAssessmentSection, openMapViewCommand, openChartViewCommand, openStackChartViewCommand; + private readonly ICommand addNewAssessmentSection, openMapViewCommand, openChartViewCommand, openStackChartViewCommand, openPointedTreeGraphViewCommand; public RingtoetsDemoProjectRibbon(IProjectOwner projectOwner, IViewCommands viewCommands) { @@ -44,6 +44,7 @@ openChartViewCommand = new OpenChartViewCommand(viewCommands); openMapViewCommand = new OpenMapViewCommand(viewCommands); openStackChartViewCommand = new OpenStackChartViewCommand(viewCommands); + openPointedTreeGraphViewCommand = new OpenPointedTreeGraphViewCommand(viewCommands); } public Ribbon GetRibbonControl() @@ -72,5 +73,10 @@ { openStackChartViewCommand.Execute(); } + + private void OpenPointedTreeGraphViewButton_OnClick(object sender, RoutedEventArgs e) + { + openPointedTreeGraphViewCommand.Execute(); + } } } \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.Designer.cs =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.Designer.cs (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.Designer.cs (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -0,0 +1,78 @@ +// 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. + +namespace Demo.Ringtoets.Views +{ + partial class PointedTreeGraphView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #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.pointedTreeGraphControl = new Core.Components.GraphSharp.Forms.PointedTreeGraphControl(); + this.SuspendLayout(); + // + // pointedTreeGraphControl + // + this.pointedTreeGraphControl.Data = null; + this.pointedTreeGraphControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.pointedTreeGraphControl.Location = new System.Drawing.Point(0, 0); + this.pointedTreeGraphControl.Name = "pointedTreeGraphControl"; + this.pointedTreeGraphControl.Size = new System.Drawing.Size(150, 150); + this.pointedTreeGraphControl.TabIndex = 0; + // + // PointedTreeGraphView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pointedTreeGraphControl); + this.Name = "PointedTreeGraphView"; + this.ResumeLayout(false); + + } + + #endregion + + private Core.Components.GraphSharp.Forms.PointedTreeGraphControl pointedTreeGraphControl; + } +} Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.cs =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.cs (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.cs (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -0,0 +1,53 @@ +// 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.Windows.Forms; +using Core.Common.Controls.Views; +using Core.Components.PointedTree.Data; + +namespace Demo.Ringtoets.Views +{ + /// + /// This class represents a simple view with a pointed tree, to which data can be added. + /// + public partial class PointedTreeGraphView : UserControl, IView + { + /// + /// Creates a new instance of . + /// + public PointedTreeGraphView() + { + InitializeComponent(); + } + + public object Data + { + get + { + return pointedTreeGraphControl.Data; + } + set + { + pointedTreeGraphControl.Data = value as GraphNode; + } + } + } +} \ No newline at end of file Index: Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.resx =================================================================== diff -u --- Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.resx (revision 0) +++ Demo/Ringtoets/src/Demo.Ringtoets/Views/PointedTreeGraphView.resx (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -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: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/OpenPointedTreeGraphViewCommandTest.cs =================================================================== diff -u --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/OpenPointedTreeGraphViewCommandTest.cs (revision 0) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/OpenPointedTreeGraphViewCommandTest.cs (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -0,0 +1,68 @@ +// 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 Core.Common.Gui.Commands; +using Demo.Ringtoets.Commands; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Demo.Ringtoets.Test.Commands +{ + [TestFixture] + public class OpenPointedTreeGraphViewCommandTest + { + [Test] + public void Execute_Always_OpensViewForGraphNode() + { + // Setup + var mocks = new MockRepository(); + var viewCommands = mocks.StrictMock(); + viewCommands.Expect(g => g.OpenView(Arg.Is.NotNull)); + mocks.ReplayAll(); + + var command = new OpenPointedTreeGraphViewCommand(viewCommands); + + // Call + command.Execute(); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void Checked_Always_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var viewCommands = mocks.Stub(); + mocks.ReplayAll(); + + var command = new OpenPointedTreeGraphViewCommand(viewCommands); + + // Call + bool isChecked = command.Checked; + + // Assert + Assert.IsFalse(isChecked); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj (.../Demo.Ringtoets.Test.csproj) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Demo.Ringtoets.Test.csproj (.../Demo.Ringtoets.Test.csproj) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -70,12 +70,14 @@ + + @@ -111,10 +113,22 @@ {318ba582-88c9-4816-a54a-a7e431461de3} Core.Components.Gis + + {4E575459-AD64-4F5F-B313-9F8E0EC8C03F} + Core.Components.GraphSharp.Forms + {DADAA0A5-288C-49CB-9F08-337F16832C86} Core.Components.OxyPlot.Forms + + {dbf5a590-2a11-4eb4-a8cc-f3036475e4d5} + Core.Components.PointedTree.Forms + + + {AD3B1634-C435-4618-9971-2EA0817F5DE2} + Core.Components.PointedTree + {72109e33-6518-4632-accf-6cbf2a312711} Core.Components.Stack.Forms Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs =================================================================== diff -u -rd98bbe7db9b448a0a61954330f80b1196b2ac760 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs (.../DemoProjectPluginTest.cs) (revision d98bbe7db9b448a0a61954330f80b1196b2ac760) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/GUIs/DemoProjectPluginTest.cs (.../DemoProjectPluginTest.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -26,6 +26,7 @@ using Core.Common.Gui.Plugin; using Core.Components.Chart.Data; using Core.Components.Gis.Data; +using Core.Components.PointedTree.Data; using Core.Components.Stack.Data; using Demo.Ringtoets.GUIs; using Demo.Ringtoets.Views; @@ -69,22 +70,27 @@ ViewInfo[] views = plugin.GetViewInfos().ToArray(); // Assert - Assert.AreEqual(3, views.Length); + Assert.AreEqual(4, views.Length); ViewInfo chartViewInfo = views[0]; Assert.AreEqual(typeof(ChartDataCollection), chartViewInfo.DataType); Assert.AreEqual(typeof(ChartDataView), chartViewInfo.ViewType); - Assert.AreEqual("Diagram", chartViewInfo.GetViewName(new ChartDataView(), null)); + Assert.AreEqual("Diagram", chartViewInfo.GetViewName(null, null)); ViewInfo mapViewInfo = views[1]; Assert.AreEqual(typeof(MapData), mapViewInfo.DataType); Assert.AreEqual(typeof(MapDataView), mapViewInfo.ViewType); - Assert.AreEqual("Kaart", mapViewInfo.GetViewName(new MapDataView(), null)); + Assert.AreEqual("Kaart", mapViewInfo.GetViewName(null, null)); ViewInfo stackChartViewInfo = views[2]; Assert.AreEqual(typeof(StackChartData), stackChartViewInfo.DataType); Assert.AreEqual(typeof(StackChartDataView), stackChartViewInfo.ViewType); - Assert.AreEqual("Diagram", stackChartViewInfo.GetViewName(new StackChartDataView(), null)); + Assert.AreEqual("Diagram", stackChartViewInfo.GetViewName(null, null)); + + ViewInfo pointedTreeGraphViewInfo = views[3]; + Assert.AreEqual(typeof(GraphNode), pointedTreeGraphViewInfo.DataType); + Assert.AreEqual(typeof(PointedTreeGraphView), pointedTreeGraphViewInfo.ViewType); + Assert.AreEqual("Foutenboom", pointedTreeGraphViewInfo.GetViewName(null, null)); } } } Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Ribbons/RingtoetsDemoProjectRibbonTest.cs =================================================================== diff -u -r9aede2609645a62e929611bb651c2624258f6a6c -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Ribbons/RingtoetsDemoProjectRibbonTest.cs (.../RingtoetsDemoProjectRibbonTest.cs) (revision 9aede2609645a62e929611bb651c2624258f6a6c) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Ribbons/RingtoetsDemoProjectRibbonTest.cs (.../RingtoetsDemoProjectRibbonTest.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -128,5 +128,30 @@ // Assert mocks.VerifyAll(); } + + [Test] + [Apartment(ApartmentState.STA)] + public void OpenPointedTreeGraphViewButton_OnClick_ExecutesOpenPointedTreeGraphViewCommand() + { + // Setup + var mocks = new MockRepository(); + var projectOwner = mocks.Stub(); + var viewCommands = mocks.Stub(); + viewCommands.Expect(vc => vc.OpenView(null)).IgnoreArguments(); + + mocks.ReplayAll(); + + var ribbon = new RingtoetsDemoProjectRibbon(projectOwner, viewCommands); + var button = ribbon.GetRibbonControl().FindName("OpenPointedTreeGraphViewButton") as Button; + + // Precondition + Assert.IsNotNull(button, "Ribbon should have an open pointed tree graph view button."); + + // Call + button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); + + // Assert + mocks.VerifyAll(); + } } } \ No newline at end of file Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/ChartDataViewTest.cs =================================================================== diff -u -r93036b575ee81b4517b29db51f1eadf81454fb93 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision 93036b575ee81b4517b29db51f1eadf81454fb93) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/ChartDataViewTest.cs (.../ChartDataViewTest.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -48,24 +48,6 @@ } [Test] - public void Data_SetToNull_ChartControlNotUpdated() - { - // Setup - using (var chartView = new ChartDataView()) - { - var chart = (ChartControl) chartView.Controls[0]; - ChartDataCollection chartData = chart.Data; - - // Call - TestDelegate testDelegate = () => chartView.Data = null; - - // Assert - Assert.DoesNotThrow(testDelegate); - Assert.AreSame(chartData, chart.Data); - } - } - - [Test] public void Data_SetToObject_DoesNotThrow() { // Setup Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs =================================================================== diff -u -rf4b3f19758b8929693ad8653bbc3c906a75d2983 -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs (.../MapDataViewTest.cs) (revision f4b3f19758b8929693ad8653bbc3c906a75d2983) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/MapDataViewTest.cs (.../MapDataViewTest.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -62,24 +62,6 @@ } [Test] - public void Data_SetToNull_MapControlNotUpdated() - { - // Setup - using (var mapView = new MapDataView()) - { - var map = (MapControl) mapView.Controls[0]; - MapDataCollection mapData = map.Data; - - // Call - TestDelegate testDelegate = () => mapView.Data = null; - - // Assert - Assert.DoesNotThrow(testDelegate); - Assert.AreSame(mapData, map.Data); - } - } - - [Test] public void Data_SetToObject_DoesNotThrow() { // Setup Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/PointedTreeGraphViewTest.cs =================================================================== diff -u --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/PointedTreeGraphViewTest.cs (revision 0) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/PointedTreeGraphViewTest.cs (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -0,0 +1,84 @@ +// 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.Threading; +using System.Windows.Forms; +using Core.Components.GraphSharp.Forms; +using Core.Components.PointedTree.Data; +using Demo.Ringtoets.Views; +using NUnit.Framework; + +namespace Demo.Ringtoets.Test.Views +{ + [TestFixture] + public class PointedTreeGraphViewTest + { + [Test] + [Apartment(ApartmentState.STA)] + public void DefaultConstructor_Always_AddsPointedTreeGraphControl() + { + // Call + using (var view = new PointedTreeGraphView()) + { + // Assert + Assert.AreEqual(1, view.Controls.Count); + object control = view.Controls[0]; + Assert.IsInstanceOf(control); + + var pointedTreeGraph = (PointedTreeGraphControl) control; + Assert.AreEqual(DockStyle.Fill, pointedTreeGraph.Dock); + } + } + + [Test] + [Apartment(ApartmentState.STA)] + public void Data_SetToObject_DoesNotThrow() + { + // Setup + using (var view = new PointedTreeGraphView()) + { + // Call + TestDelegate testDelegate = () => view.Data = new object(); + + // Assert + Assert.DoesNotThrow(testDelegate); + Assert.IsNull(view.Data); + } + } + + [Test] + [Apartment(ApartmentState.STA)] + public void Data_SetToGraphNode_DataSet() + { + // Setup + using (var view = new PointedTreeGraphView()) + { + var graphNode = new GraphNode("Root node", new GraphNode[0], false); + + // Call + view.Data = graphNode; + + // Assert + Assert.AreSame(graphNode, view.Data); + } + } + } +} \ No newline at end of file Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/StackChartDataViewTest.cs =================================================================== diff -u -ra2a3022ca8b69a87b4afde3727ebc035f132978f -r21debbdc1d176c418e0b1f17adcf997e7794ff0b --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/StackChartDataViewTest.cs (.../StackChartDataViewTest.cs) (revision a2a3022ca8b69a87b4afde3727ebc035f132978f) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Views/StackChartDataViewTest.cs (.../StackChartDataViewTest.cs) (revision 21debbdc1d176c418e0b1f17adcf997e7794ff0b) @@ -47,24 +47,6 @@ } [Test] - public void Data_SetToNull_ChartControlNotUpdated() - { - // Setup - using (var chartView = new StackChartDataView()) - { - var chart = (StackChartControl) chartView.Controls[0]; - StackChartData chartData = chart.Data; - - // Call - TestDelegate testDelegate = () => chartView.Data = null; - - // Assert - Assert.DoesNotThrow(testDelegate); - Assert.AreSame(chartData, chart.Data); - } - } - - [Test] public void Data_SetToObject_DoesNotThrow() { // Setup