Index: Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/Ringtoets.Asphalt.Plugin.csproj =================================================================== diff -u -rbbf215488ec670989eca94379ea62ef4c9155540 -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/Ringtoets.Asphalt.Plugin.csproj (.../Ringtoets.Asphalt.Plugin.csproj) (revision bbf215488ec670989eca94379ea62ef4c9155540) +++ Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/Ringtoets.Asphalt.Plugin.csproj (.../Ringtoets.Asphalt.Plugin.csproj) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -80,6 +80,16 @@ Ringtoets.Common.Forms False + + {52ba7627-cbab-4209-be77-3b5f31378277} + Ringtoets.Common.IO + False + + + {C8383B76-B3F1-4E6E-B56C-527B469FA20A} + Ringtoets.Integration.Plugin + False + {567E0B69-5280-41CE-ADD6-443725A61C86} Ringtoets.Asphalt.Data Index: Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/WaveImpactAsphaltCoverPlugin.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Asphalt/src/Ringtoets.Asphalt.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -34,8 +34,11 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; +using Ringtoets.Integration.Plugin.FileImporters; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; +using RingtoetsIntegrationPluginResources = Ringtoets.Integration.Plugin.Properties.Resources; namespace Ringtoets.Asphalt.Plugin { @@ -63,6 +66,21 @@ }; } + public override IEnumerable GetImportInfos() + { + yield return new ImportInfo + { + CreateFileImporter = (context, filePath) => new ForeshoreProfilesImporter(context.WrappedData, + context.ParentAssessmentSection.ReferenceLine, + filePath), + Name = RingtoetsIntegrationPluginResources.ForeshoreProfilesImporter_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = RingtoetsIntegrationPluginResources.Foreshore, + FileFilter = RingtoetsCommonIOResources.DataTypeDisplayName_shape_file_filter, + IsEnabled = context => context.ParentAssessmentSection.ReferenceLine != null + }; + } + public override IEnumerable GetTreeNodeInfos() { yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( @@ -73,7 +91,7 @@ yield return new TreeNodeInfo { - Text = context => RingtoetsCommonFormsResources.Plugin_GetTreeNodeInfos_ForeShores, + Text = context => RingtoetsCommonFormsResources.Plugin_ForeShores_DisplayName, Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, ForeColor = context => context.WrappedData.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -1,7 +1,28 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -1003,9 +1024,9 @@ /// /// Looks up a localized string similar to Voorlanden. /// - public static string Plugin_GetTreeNodeInfos_ForeShores { + public static string Plugin_ForeShores_DisplayName { get { - return ResourceManager.GetString("Plugin_GetTreeNodeInfos_ForeShores", resourceCulture); + return ResourceManager.GetString("Plugin_ForeShores_DisplayName", resourceCulture); } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -442,7 +442,7 @@ Genereer &berekeningen... - + Voorlanden Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/DikeProfilesImporter.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/DikeProfilesImporter.cs (.../DikeProfilesImporter.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/DikeProfilesImporter.cs (.../DikeProfilesImporter.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -49,8 +49,8 @@ /// The reference line used to check if the /// objects found in the file are intersecting it. /// The path to the file to import from. - /// Thrown when - /// is null. + /// Thrown when , + /// or is null. public DikeProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath) : base(referenceLine, filePath, importTarget) { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ForeshoreProfilesImporter.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ForeshoreProfilesImporter.cs (.../ForeshoreProfilesImporter.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ForeshoreProfilesImporter.cs (.../ForeshoreProfilesImporter.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -47,8 +47,8 @@ /// The reference line used to check if the /// objects found in the file are intersecting it. /// The path to the file to import from. - /// Thrown when - /// is null. + /// Thrown when , + /// or is null. public ForeshoreProfilesImporter(ObservableList importTarget, ReferenceLine referenceLine, string filePath) : base(referenceLine, filePath, importTarget) { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ProfilesImporter.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -54,7 +54,8 @@ /// The reference line used to check if the imported profiles are intersecting it. /// The path to the file to import from. /// The import target. - /// Thrown when is null. + /// Thrown when , + /// or is null. protected ProfilesImporter(ReferenceLine referenceLine, string filePath, T importTarget) : base(filePath, importTarget) { if (referenceLine == null) Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -1,4 +1,25 @@ -//------------------------------------------------------------------------------ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -192,6 +213,15 @@ } /// + /// Looks up a localized string similar to Voorlandprofiel locaties. + /// + public static string ForeshoreProfilesImporter_DisplayName { + get { + return ResourceManager.GetString("ForeshoreProfilesImporter_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan geen geldige voorlandprofieldata vinden voor voorlandprofiel locatie met ID: {0}. /// public static string ForeshoreProfilesImporter_GetMatchingForeshoreProfileData_no_foreshoreprofiledata_for_location_0_ { @@ -212,15 +242,6 @@ } /// - /// Looks up a localized string similar to Voorland locaties. - /// - public static string ForeshoresImporter_DisplayName { - get { - return ResourceManager.GetString("ForeshoresImporter_DisplayName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to {0} Het bestand wordt overgeslagen.. /// public static string HydraulicBoundaryDatabaseImporter_ErrorMessage_0_file_skipped { @@ -258,78 +279,78 @@ } /// - /// Looks up a localized string similar to LocationID - ///300130 - ///300131 - ///300189 - ///300353 - ///300354 - ///300355 - ///300357 - ///300358 - ///300359 - ///300360 - ///300361 - ///300362 - ///300363 - ///300364 - ///300365 - ///300366 - ///300367 - ///300368 - ///300369 - ///300370 - ///300371 - ///300372 - ///300373 - ///300374 - ///300375 - ///300376 - ///300608 - ///300609 - ///300610 - ///300611 - ///300612 - ///300633 - ///300634 - ///300635 - ///300636 - ///300637 - ///300657 - ///300658 - ///300659 - ///300660 - ///300661 - ///300662 - ///300663 - ///300664 - ///300665 - ///300703 - ///300704 - ///300745 - ///300748 - ///300761 - ///300762 - ///300765 - ///300766 - ///300767 - ///300824 - ///300825 - ///300826 - ///300828 - ///300829 - ///300830 - ///300864 - ///300865 - ///301595 - ///301596 - ///301597 - ///301598 - ///301599 - ///301600 - ///301601 - ///301602 - ///301603 + /// Looks up a localized string similar to LocationID + ///300130 + ///300131 + ///300189 + ///300353 + ///300354 + ///300355 + ///300357 + ///300358 + ///300359 + ///300360 + ///300361 + ///300362 + ///300363 + ///300364 + ///300365 + ///300366 + ///300367 + ///300368 + ///300369 + ///300370 + ///300371 + ///300372 + ///300373 + ///300374 + ///300375 + ///300376 + ///300608 + ///300609 + ///300610 + ///300611 + ///300612 + ///300633 + ///300634 + ///300635 + ///300636 + ///300637 + ///300657 + ///300658 + ///300659 + ///300660 + ///300661 + ///300662 + ///300663 + ///300664 + ///300665 + ///300703 + ///300704 + ///300745 + ///300748 + ///300761 + ///300762 + ///300765 + ///300766 + ///300767 + ///300824 + ///300825 + ///300826 + ///300828 + ///300829 + ///300830 + ///300864 + ///300865 + ///301595 + ///301596 + ///301597 + ///301598 + ///301599 + ///301600 + ///301601 + ///301602 + ///301603 ///3016 [rest of string was truncated]";. /// public static string HydraulicBoundaryLocationsFilterList { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -164,8 +164,8 @@ ..\Resources\Exceptions_DoNotCalculate.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - Voorland locaties + + Voorlandprofiel locaties ..\Resources\Foreshore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/DikeProfilesImporterTest.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/DikeProfilesImporterTest.cs (.../DikeProfilesImporterTest.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/DikeProfilesImporterTest.cs (.../DikeProfilesImporterTest.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -66,6 +66,39 @@ } [Test] + public void ParameterdConstructor_ImportTargetNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new DikeProfilesImporter(null, new ReferenceLine(), ""); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("importTarget", exception.ParamName); + } + + [Test] + public void ParameterdConstructor_ReferenceLineNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new DikeProfilesImporter(new ObservableList(), null, ""); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("referenceLine", exception.ParamName); + } + + [Test] + public void ParameterdConstructor_FilePathNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new DikeProfilesImporter(new ObservableList(), new ReferenceLine(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("filePath", exception.ParamName); + } + + [Test] public void Import_FromFileWithUnmatchableId_TrueAndLogError() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/ForeshoreProfilesImporterTest.cs =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/ForeshoreProfilesImporterTest.cs (.../ForeshoreProfilesImporterTest.cs) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/ForeshoreProfilesImporterTest.cs (.../ForeshoreProfilesImporterTest.cs) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -63,6 +63,39 @@ } [Test] + public void ParameterdConstructor_ImportTargetNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new ForeshoreProfilesImporter(null, new ReferenceLine(), ""); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("importTarget", exception.ParamName); + } + + [Test] + public void ParameterdConstructor_ReferenceLineNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new ForeshoreProfilesImporter(new ObservableList(), null, ""); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("referenceLine", exception.ParamName); + } + + [Test] + public void ParameterdConstructor_FilePathNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new ForeshoreProfilesImporter(new ObservableList(), new ReferenceLine(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("filePath", exception.ParamName); + } + + [Test] public void Import_FromFileWithUnmatchableId_TrueAndLogError() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/ForeshoreProfilesContextImportInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/ForeshoreProfilesContextImportInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/ForeshoreProfilesContextImportInfoTest.cs (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -0,0 +1,180 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Drawing; +using System.IO; +using System.Linq; +using Core.Common.Base; +using Core.Common.Base.Geometry; +using Core.Common.Base.IO; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Asphalt.Plugin; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin.Properties; + +namespace Ringtoets.Integration.Plugin.Test.ImportInfos +{ + public class ForeshoreProfilesContextImportInfoTest + { + private ImportInfo importInfo; + private WaveImpactAsphaltCoverPlugin plugin; + + [SetUp] + public void SetUp() + { + plugin = new WaveImpactAsphaltCoverPlugin(); + importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(ForeshoreProfilesContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Call + string name = importInfo.Name; + + // Assert + Assert.AreEqual("Voorlandprofiel locaties", name); + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = importInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Call + Image image = importInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(Resources.Foreshore, image); + } + + [Test] + public void IsEnabled_ReferenceLineSet_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + assessmentSection.ReferenceLine = new ReferenceLine(); + mocks.ReplayAll(); + + var list = new ObservableList(); + + var context = new ForeshoreProfilesContext(list, assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_ReferenceLineNotSet_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + assessmentSection.ReferenceLine = null; + mocks.ReplayAll(); + + var list = new ObservableList(); + + var context = new ForeshoreProfilesContext(list, assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void FileFilter_Always_ReturnExpectedFileFilter() + { + // Call + string fileFilter = importInfo.FileFilter; + + // Assert + Assert.AreEqual("ESRI Shapefile (*.shp)|*.shp", fileFilter); + } + + [Test] + public void CreateFileImporter_ValidInput_SuccesfullImport() + { + // Setup + var mocks = new MockRepository(); + ReferenceLine referenceLine = CreateMatchingReferenceLine(); + var assessmentSection = mocks.Stub(); + assessmentSection.ReferenceLine = referenceLine; + mocks.ReplayAll(); + + var list = new ObservableList(); + + string path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin, + Path.Combine("DikeProfiles", "AllOkTestData", "Voorlanden 12-2.shp")); + + var importTarget = new ForeshoreProfilesContext(list, assessmentSection); + + // Call + IFileImporter importer = importInfo.CreateFileImporter(importTarget, path); + + // Assert + Assert.IsTrue(importer.Import()); + + mocks.VerifyAll(); + } + + private ReferenceLine CreateMatchingReferenceLine() + { + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(new[] + { + new Point2D(131223.2, 548393.4), + new Point2D(133854.3, 545323.1), + new Point2D(135561.0, 541920.3), + new Point2D(136432.1, 538235.2), + new Point2D(136039.4, 533920.2) + }); + return referenceLine; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rfdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 1dddcf22e6d496a00dcfe85cf8d1302a8df121cd) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision fdb3a9b9fb6e78d48d47b6fb1abe5db45f80b6dd) @@ -75,6 +75,7 @@ +