Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rb70aa5e9027d1358a2dc38029c2eadae3d3eed4c -re3948ad61fcc36c71cb04793e2ed543c849609dd
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision b70aa5e9027d1358a2dc38029c2eadae3d3eed4c)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -132,6 +132,14 @@
+
+
+
+
+
+
+
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffInwardsFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffInwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffInwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new GrassCoverSlipOffInwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(GrassCoverSlipOffInwardsFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/GrassCoverSlipOffOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new GrassCoverSlipOffOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(GrassCoverSlipOffOutwardsFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MacroStabilityOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MacroStabilityOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MacroStabilityOutwardsFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new MacroStabilityOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new MacroStabilityOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var context = new MacroStabilityOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new MacroStabilityOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(MacroStabilityOutwardsFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MicrostabilityFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MicrostabilityFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/MicrostabilityFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new MicrostabilityFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+ var context = new MicrostabilityFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+ var context = new MicrostabilityFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new MicrostabilityFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(MicrostabilityFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/PipingStructureFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/PipingStructureFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/PipingStructureFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class PipingStructureFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new PipingStructureFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ var context = new PipingStructureFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+ var context = new PipingStructureFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingStructureFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new PipingStructureFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(PipingStructureFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ var context = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ var context = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/TechnicalInnovationFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/TechnicalInnovationFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/TechnicalInnovationFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class TechnicalInnovationFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new TechnicalInnovationFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+ var context = new TechnicalInnovationFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+ var context = new TechnicalInnovationFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TechnicalInnovationFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new TechnicalInnovationFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(TechnicalInnovationFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/WaterPressureAsphaltCoverFailureMechanismSectionsContextUpdateInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/WaterPressureAsphaltCoverFailureMechanismSectionsContextUpdateInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/UpdateInfos/WaterPressureAsphaltCoverFailureMechanismSectionsContextUpdateInfoTest.cs (revision e3948ad61fcc36c71cb04793e2ed543c849609dd)
@@ -0,0 +1,216 @@
+// 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 System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Forms.PresentationObjects.StandAlone;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.UpdateInfos
+{
+ [TestFixture]
+ public class WaterPressureAsphaltCoverFailureMechanismSectionsContextUpdateInfoTest
+ {
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Vakindeling", name);
+ }
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.SectionsIcon, image);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ bool isEnabled = importInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Setup
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo importInfo = GetUpdateInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void CreateFileImporter_WithValidData_ReturnsFileImporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ assessmentSection.ReferenceLine = new ReferenceLine();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty);
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism();
+
+ string sourcePath = TestHelper.GetScratchPadPath();
+ failureMechanism.SetSections(Enumerable.Empty(), sourcePath);
+ var context = new WaterPressureAsphaltCoverFailureMechanismSectionsContext(failureMechanism, assessmentSection);
+
+ using (var plugin = new RingtoetsPlugin())
+ {
+ UpdateInfo updateInfo = GetUpdateInfo(plugin);
+
+ // Call
+ string currentFilePath = updateInfo.CurrentPath(context);
+
+ // Assert
+ Assert.AreEqual(sourcePath, currentFilePath);
+ mocks.VerifyAll();
+ }
+ }
+
+ private static UpdateInfo GetUpdateInfo(RingtoetsPlugin plugin)
+ {
+ return plugin.GetUpdateInfos().First(ii => ii.DataType == typeof(WaterPressureAsphaltCoverFailureMechanismSectionsContext));
+ }
+ }
+}
\ No newline at end of file