Index: Application/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -173,7 +173,8 @@ new ProjectExplorerGuiPlugin(), new CommonToolsGuiPlugin(), new SharpMapGisGuiPlugin(), - new RingtoetsGuiPlugin() + new RingtoetsGuiPlugin(), + new PipingGuiPlugin() #if INCLUDE_DEMOPROJECT ,new DemoProjectGuiPlugin() #endif @@ -184,7 +185,8 @@ { new CommonToolsApplicationPlugin(), new SharpMapGisApplicationPlugin(), - new RingtoetsApplicationPlugin() + new RingtoetsApplicationPlugin(), + new PipingApplicationPlugin() } } }; Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsApplicationPlugin.cs (.../RingtoetsApplicationPlugin.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -3,12 +3,14 @@ using Core.Common.Base; using Ringtoets.Integration.Data; -using Ringtoets.Piping.Plugin; using RingtoetsFormsResources = Ringtoets.Integration.Forms.Properties.Resources; namespace Ringtoets.Integration.Plugin { + /// + /// The application plugin for Ringtoets. + /// public class RingtoetsApplicationPlugin : ApplicationPlugin { public override IEnumerable GetDataItemInfos() @@ -21,13 +23,5 @@ CreateData = owner => new DikeAssessmentSection() }; } - - public override IEnumerable GetFileImporters() - { - foreach (var pipingFileImporter in PipingFileImporterProvider.GetFileImporters()) - { - yield return pipingFileImporter; - } - } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -11,32 +11,27 @@ namespace Ringtoets.Integration.Plugin { + /// + /// The GUI plugin for the Ringtoets application. + /// public class RingtoetsGuiPlugin : GuiPlugin { public override IRibbonCommandHandler RibbonCommandHandler { get { - return new RingtoetsRibbon(); + return new PipingRibbon(); } } public override IEnumerable GetPropertyInfos() { yield return new PropertyInfo(); - foreach (var propertyInfo in new PipingGuiPlugin().GetPropertyInfos()) - { - yield return propertyInfo; - } } public override IEnumerable GetProjectTreeViewNodePresenters() { yield return new AssessmentSectionNodePresenter(); - foreach (var pipingNodePresenter in new PipingGuiPlugin { Gui = Gui }.GetProjectTreeViewNodePresenters()) - { - yield return pipingNodePresenter; - } } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsApplicationPluginTest.cs (.../RingtoetsApplicationPluginTest.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -43,20 +43,5 @@ Assert.IsInstanceOf(AssessmentSectionDataItemDefinition.CreateData(null)); Assert.IsNull(AssessmentSectionDataItemDefinition.AddExampleData); } - - [Test] - public void GetFileImporters_Always_ReturnExpectedFileImporters() - { - // Setup - var plugin = new RingtoetsApplicationPlugin(); - - // Call - var importers = plugin.GetFileImporters().ToArray(); - - // Assert - Assert.AreEqual(2, importers.Length); - Assert.IsInstanceOf(importers[0]); - Assert.IsInstanceOf(importers[1]); - } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -33,7 +33,7 @@ { // assert Assert.IsInstanceOf(ringtoetsGuiPlugin); - Assert.IsInstanceOf(ringtoetsGuiPlugin.RibbonCommandHandler); + Assert.IsInstanceOf(ringtoetsGuiPlugin.RibbonCommandHandler); } } @@ -47,37 +47,13 @@ PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); // assert - Assert.AreEqual(5, propertyInfos.Length); + Assert.AreEqual(1, propertyInfos.Length); var assessmentSectionProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(DikeAssessmentSection)); Assert.AreEqual(typeof(AssessmentSectionProperties), assessmentSectionProperties.PropertyType); Assert.IsNull(assessmentSectionProperties.AdditionalDataCheck); Assert.IsNull(assessmentSectionProperties.GetObjectPropertiesData); Assert.IsNull(assessmentSectionProperties.AfterCreate); - - var pipingDataProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingCalculationInputs)); - Assert.AreEqual(typeof(PipingCalculationInputsProperties), pipingDataProperties.PropertyType); - Assert.IsNull(pipingDataProperties.AdditionalDataCheck); - Assert.IsNull(pipingDataProperties.GetObjectPropertiesData); - Assert.IsNull(pipingDataProperties.AfterCreate); - - var pipingOutputProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingOutput)); - Assert.AreEqual(typeof(PipingOutputProperties), pipingOutputProperties.PropertyType); - Assert.IsNull(pipingOutputProperties.AdditionalDataCheck); - Assert.IsNull(pipingOutputProperties.GetObjectPropertiesData); - Assert.IsNull(pipingOutputProperties.AfterCreate); - - var pipingSurfaceLineProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(RingtoetsPipingSurfaceLine)); - Assert.AreEqual(typeof(RingtoetsPipingSurfaceLineProperties), pipingSurfaceLineProperties.PropertyType); - Assert.IsNull(pipingSurfaceLineProperties.AdditionalDataCheck); - Assert.IsNull(pipingSurfaceLineProperties.GetObjectPropertiesData); - Assert.IsNull(pipingSurfaceLineProperties.AfterCreate); - - var pipingSoilProfileProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingSoilProfile)); - Assert.AreEqual(typeof(PipingSoilProfileProperties), pipingSoilProfileProperties.PropertyType); - Assert.IsNull(pipingSoilProfileProperties.AdditionalDataCheck); - Assert.IsNull(pipingSoilProfileProperties.GetObjectPropertiesData); - Assert.IsNull(pipingSoilProfileProperties.AfterCreate); } } @@ -101,15 +77,8 @@ ITreeNodePresenter[] nodePresenters = guiPlugin.GetProjectTreeViewNodePresenters().ToArray(); // assert - Assert.AreEqual(8, nodePresenters.Length); + Assert.AreEqual(1, nodePresenters.Length); Assert.IsTrue(nodePresenters.Any(np => np is AssessmentSectionNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineCollectionNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingSoilProfileCollectionNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingSoilProfileNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingCalculationInputsNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingFailureMechanismNodePresenter)); - Assert.IsTrue(nodePresenters.Any(np => np is PipingOutputNodePresenter)); } mocks.VerifyAll(); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingApplicationPlugin.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingApplicationPlugin.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingApplicationPlugin.cs (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Core.Common.Base; + +using Ringtoets.Piping.Plugin.FileImporter; + +namespace Ringtoets.Piping.Plugin +{ + /// + /// The application plugin for the piping failure mechanism. + /// + public class PipingApplicationPlugin : ApplicationPlugin + { + public override IEnumerable GetFileImporters() + { + yield return new PipingSurfaceLinesCsvImporter(); + yield return new PipingSoilProfilesImporter(); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -raa5c3620f316831e71797c558a13a0b73a8109df -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision aa5c3620f316831e71797c558a13a0b73a8109df) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -17,7 +17,7 @@ { get { - return new RingtoetsRibbon(); + return new PipingRibbon(); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -0,0 +1,13 @@ + + + + + + Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingRibbon.xaml.cs (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Core.Common.Controls; +using Core.Common.Gui.Forms; + +namespace Ringtoets.Piping.Plugin +{ + /// + /// Interaction logic for RingtoetsRibbon.xaml + /// + public partial class PipingRibbon : IRibbonCommandHandler + { + public PipingRibbon() + { + InitializeComponent(); + } + + public IEnumerable Commands + { + get + { + yield break; + } + } + + public object GetRibbonControl() + { + return RingtoetsRibbonControl; + } + + public void ValidateItems() {} + + public bool IsContextualTabVisible(string tabGroupName, string tabName) + { + return false; + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj =================================================================== diff -u -r31d7b5552adb7b89eaf1552855f88c5df887e4f9 -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 31d7b5552adb7b89eaf1552855f88c5df887e4f9) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Ringtoets.Piping.Plugin.csproj (.../Ringtoets.Piping.Plugin.csproj) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -78,6 +78,7 @@ + @@ -86,8 +87,8 @@ Resources.resx - - RingtoetsRibbon.xaml + + PipingRibbon.xaml @@ -145,7 +146,7 @@ - + Designer MSBuild:Compile Fisheye: Tag 0d5ba527995a1b3de4041babb246d675e305d0c1 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsRibbon.xaml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 0d5ba527995a1b3de4041babb246d675e305d0c1 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Plugin/RingtoetsRibbon.xaml.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingApplicationPluginTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingApplicationPluginTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingApplicationPluginTest.cs (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -0,0 +1,36 @@ +using System.Linq; +using Core.Common.Base; +using NUnit.Framework; +using Ringtoets.Piping.Plugin.FileImporter; + +namespace Ringtoets.Piping.Plugin.Test +{ + [TestFixture] + public class PipingApplicationPluginTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // call + var ringtoetsApplicationPlugin = new PipingApplicationPlugin(); + + // assert + Assert.IsInstanceOf(ringtoetsApplicationPlugin); + } + + [Test] + public void GetFileImporters_Always_ReturnExpectedFileImporters() + { + // Setup + var plugin = new PipingApplicationPlugin(); + + // Call + var importers = plugin.GetFileImporters().ToArray(); + + // Assert + Assert.AreEqual(2, importers.Length); + Assert.IsInstanceOf(importers[0]); + Assert.IsInstanceOf(importers[1]); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -0,0 +1,108 @@ +using System; +using System.Linq; +using Core.Common.Base; +using Core.Common.Base.Workflow; +using Core.Common.Controls; +using Core.Common.Gui; + +using NUnit.Framework; + +using Rhino.Mocks; + +using Ringtoets.Piping.Data; + +using Ringtoets.Piping.Forms.NodePresenters; +using Ringtoets.Piping.Forms.PresentationObjects; +using Ringtoets.Piping.Forms.PropertyClasses; + +using GuiPluginResources = Ringtoets.Piping.Plugin.Properties.Resources; + +namespace Ringtoets.Piping.Plugin.Test +{ + [TestFixture] + public class PipingGuiPluginTest + { + [Test] + [STAThread] // For creation of XAML UI component + public void DefaultConstructor_ExpectedValues() + { + // call + using (var ringtoetsGuiPlugin = new PipingGuiPlugin()) + { + // assert + Assert.IsInstanceOf(ringtoetsGuiPlugin); + Assert.IsInstanceOf(ringtoetsGuiPlugin.RibbonCommandHandler); + } + } + + [Test] + public void GetPropertyInfos_ReturnsSupportedPropertyClasses() + { + // setup + using (var guiPlugin = new PipingGuiPlugin()) + { + // call + PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); + + // assert + Assert.AreEqual(4, propertyInfos.Length); + + var pipingDataProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingCalculationInputs)); + Assert.AreEqual(typeof(PipingCalculationInputsProperties), pipingDataProperties.PropertyType); + Assert.IsNull(pipingDataProperties.AdditionalDataCheck); + Assert.IsNull(pipingDataProperties.GetObjectPropertiesData); + Assert.IsNull(pipingDataProperties.AfterCreate); + + var pipingOutputProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingOutput)); + Assert.AreEqual(typeof(PipingOutputProperties), pipingOutputProperties.PropertyType); + Assert.IsNull(pipingOutputProperties.AdditionalDataCheck); + Assert.IsNull(pipingOutputProperties.GetObjectPropertiesData); + Assert.IsNull(pipingOutputProperties.AfterCreate); + + var pipingSurfaceLineProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(RingtoetsPipingSurfaceLine)); + Assert.AreEqual(typeof(RingtoetsPipingSurfaceLineProperties), pipingSurfaceLineProperties.PropertyType); + Assert.IsNull(pipingSurfaceLineProperties.AdditionalDataCheck); + Assert.IsNull(pipingSurfaceLineProperties.GetObjectPropertiesData); + Assert.IsNull(pipingSurfaceLineProperties.AfterCreate); + + var pipingSoilProfileProperties = propertyInfos.Single(pi => pi.ObjectType == typeof(PipingSoilProfile)); + Assert.AreEqual(typeof(PipingSoilProfileProperties), pipingSoilProfileProperties.PropertyType); + Assert.IsNull(pipingSoilProfileProperties.AdditionalDataCheck); + Assert.IsNull(pipingSoilProfileProperties.GetObjectPropertiesData); + Assert.IsNull(pipingSoilProfileProperties.AfterCreate); + } + } + + [Test] + public void GetProjectTreeViewNodePresenters_ReturnsSupportedNodePresenters() + { + // setup + var mocks = new MockRepository(); + var application = mocks.Stub(); + application.Stub(a => a.ActivityRunner).Return(mocks.Stub()); + + var guiStub = mocks.Stub(); + guiStub.CommandHandler = mocks.Stub(); + guiStub.Application = application; + + mocks.ReplayAll(); + + using (var guiPlugin = new PipingGuiPlugin { Gui = guiStub }) + { + // call + ITreeNodePresenter[] nodePresenters = guiPlugin.GetProjectTreeViewNodePresenters().ToArray(); + + // assert + Assert.AreEqual(7, nodePresenters.Length); + Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineCollectionNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingSurfaceLineNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingSoilProfileCollectionNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingSoilProfileNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingCalculationInputsNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingFailureMechanismNodePresenter)); + Assert.IsTrue(nodePresenters.Any(np => np is PipingOutputNodePresenter)); + } + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj =================================================================== diff -u -r31d7b5552adb7b89eaf1552855f88c5df887e4f9 -r0d5ba527995a1b3de4041babb246d675e305d0c1 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 31d7b5552adb7b89eaf1552855f88c5df887e4f9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 0d5ba527995a1b3de4041babb246d675e305d0c1) @@ -45,25 +45,39 @@ ..\..\..\..\lib\nunit.framework.dll + + ..\..\..\..\lib\Rhino.Mocks.dll + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} Core.Common.Base + + {9a2d67e6-26ac-4d17-b11a-2b4372f2f572} + Core.Common.Controls + + + {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} + Core.Common.Gui + {d749ee4c-ce50-4c17-bf01-9a953028c126} Core.Common.TestUtils