Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/FailureMechanismSectionsImporterTest.cs =================================================================== diff -u -ra9aafffab97152303562110b1d789bacb465ce24 -r833f568eb8b0425ddf63f74a451fff96f2da82db --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/FailureMechanismSectionsImporterTest.cs (.../FailureMechanismSectionsImporterTest.cs) (revision a9aafffab97152303562110b1d789bacb465ce24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/FailureMechanismSectionsImporterTest.cs (.../FailureMechanismSectionsImporterTest.cs) (revision 833f568eb8b0425ddf63f74a451fff96f2da82db) @@ -1,23 +1,38 @@ -using System; +// 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; using System.Collections.Generic; using System.IO; using System.Linq; - using Core.Common.Base.Geometry; using Core.Common.Base.IO; using Core.Common.TestUtil; - using NUnit.Framework; - using Rhino.Mocks; - -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.IO; using Ringtoets.Integration.Plugin.FileImporters; - using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.Integration.Plugin.Test.FileImporters @@ -205,10 +220,7 @@ var importer = new FailureMechanismSectionsImporter { - ProgressChanged = (description, step, steps) => - { - progressChangeNotifications.Add(new ProgressNotification(description, step, steps)); - } + ProgressChanged = (description, step, steps) => { progressChangeNotifications.Add(new ProgressNotification(description, step, steps)); } }; var failureMechanism = new Simple(); @@ -299,7 +311,7 @@ // Assert var expectedMessage = string.Format(@"Fout bij het lezen van bestand '{0}': Het bestand bestaat niet. ", sectionsFilePath) + Environment.NewLine + - "Er is geen vakindeling geïmporteerd."; + "Er is geen vakindeling geïmporteerd."; TestHelper.AssertLogMessageIsGenerated(call, expectedMessage, 1); Assert.IsFalse(importSuccessful); CollectionAssert.IsEmpty(failureMechanism.Sections); @@ -373,12 +385,13 @@ } [Test] - [TestCase("Artificial_referencelijn_testA_InvalidVakken_SectionStartTooFarFromReferenceline.shp")] - [TestCase("Artificial_referencelijn_testA_InvalidVakken_SectionEndTooFarFromReferenceline.shp")] - public void Import_InvalidArtificialFileBecauseOfStartEndPointsTooFarFromReferenceLine_CancelImportWithErrorMessage(string shapeFileName) + [TestCase("StartTooFarFromReferenceline")] + [TestCase("EndTooFarFromReferenceline")] + public void Import_InvalidArtificialFileBecauseOfStartEndPointsTooFarFromReferenceLine_CancelImportWithErrorMessage(string shapeCondition) { // Setup var referenceLineFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, "Artificial_referencelijn_testA.shp"); + var shapeFileName = String.Format("Artificial_referencelijn_testA_InvalidVakken_Section{0}.shp", shapeCondition); var sectionsFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, shapeFileName); var mocks = new MockRepository(); @@ -410,12 +423,13 @@ } [Test] - [TestCase("Artificial_referencelijn_testA_InvalidVakken_StartTooFarFromReferencelineStart.shp")] - [TestCase("Artificial_referencelijn_testA_InvalidVakken_EndTooFarFromReferencelineEnd.shp")] - public void Import_InvalidArtificialFileBecauseOfStartEndPointsTooFarFromStartEndOfReferenceLine_CancelImportWithErrorMessage(string shapeFileName) + [TestCase("StartTooFarFromReferencelineStart")] + [TestCase("EndTooFarFromReferencelineEnd")] + public void Import_InvalidArtificialFileBecauseOfStartEndPointsTooFarFromStartEndOfReferenceLine_CancelImportWithErrorMessage(string shapeCondition) { // Setup var referenceLineFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, "Artificial_referencelijn_testA.shp"); + var shapeFileName = String.Format("Artificial_referencelijn_testA_InvalidVakken_{0}.shp", shapeCondition); var sectionsFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Common.IO, shapeFileName); var mocks = new MockRepository(); @@ -558,22 +572,22 @@ // 1. Start & End coherence: Assert.AreEqual(referenceLineGeometry[0], sections[0].GetStart(), - "Start of the sections should correspond to the Start of the reference line."); - Assert.AreEqual(referenceLineGeometry[referenceLineGeometry.Length - 1], sections[sections.Length-1].GetLast(), - "End of the sections should correspond to the End of the reference line."); + "Start of the sections should correspond to the Start of the reference line."); + Assert.AreEqual(referenceLineGeometry[referenceLineGeometry.Length - 1], sections[sections.Length - 1].GetLast(), + "End of the sections should correspond to the End of the reference line."); // 2. Total length coherence: var totalLengthOfSections = sections.Sum(s => GetLengthOfLine(s.Points)); var totalLengthOfReferenceLine = GetLengthOfLine(referenceLineGeometry); Assert.AreEqual(totalLengthOfReferenceLine, totalLengthOfSections, 1e-6, - "The length of all sections should sum up to the length of the reference line."); + "The length of all sections should sum up to the length of the reference line."); // 3. Section Start and End coherence IEnumerable allStartAndEndPoints = sections.Select(s => s.GetStart()).Concat(sections.Select(s => s.GetLast())); foreach (Point2D point in allStartAndEndPoints) { Assert.Less(GetDistanceToReferenceLine(point, referenceLine), 1e-6, - "All start- and end points should be on the reference line."); + "All start- and end points should be on the reference line."); } // 4. Section Start and End points coherence @@ -586,7 +600,7 @@ if (sectionTowardsStart != null) { Assert.AreEqual(sectionTowardsStart.GetLast(), sectionTowardsEnd.GetStart(), - "All sections should be connected and in order of connectedness."); + "All sections should be connected and in order of connectedness."); } } } @@ -626,7 +640,7 @@ { get { - throw new System.NotImplementedException(); + throw new NotImplementedException(); } } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs =================================================================== diff -u -rc4d2af65ad23757fb3bd11f93458839bc1787ded -r833f568eb8b0425ddf63f74a451fff96f2da82db --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision c4d2af65ad23757fb3bd11f93458839bc1787ded) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 833f568eb8b0425ddf63f74a451fff96f2da82db) @@ -1,21 +1,39 @@ -using System; +// 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; using System.IO; using System.Linq; using System.Text; - using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Common.Base.IO; using Core.Common.TestUtil; using Core.Common.Utils.Builders; using NUnit.Framework; using Rhino.Mocks; -using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Plugin.FileImporter; - using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources; using PipingIOResources = Ringtoets.Piping.IO.Properties.Resources; using PipingDataResources = Ringtoets.Piping.Data.Properties.Resources; @@ -255,10 +273,10 @@ var mesages = new[] { string.Format(PipingPluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_, - validFilePath), + validFilePath), "Profielschematisatie Rotterdam1 bevat aaneengesloten dubbele geometrie punten, welke zijn genegeerd.", string.Format(PipingPluginResources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_, - validFilePath), + validFilePath), string.Format(PipingPluginResources.PipingSurfaceLinesCsvImporter_Import_No_characteristic_points_file_for_surface_line_file_expecting_file_0_, Path.Combine(ioTestDataPath, "ValidSurfaceLine_HasConsecutiveDuplicatePoints.krp.csv")), PipingPluginResources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Start_adding_surface_lines, @@ -1385,13 +1403,13 @@ } [Test] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidBottomDitchDikeSide", "Slootbodem dijkzijde")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidBottomDitchPolderSide", "Slootbodem polderzijde")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidDikeToeAtPolder", "Teen dijk binnenwaarts")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidDikeToeAtRiver", "Teen dijk buitenwaarts")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidDitchDikeSide", "Insteek sloot dijkzijde")] - [TestCase("TwoValidSurfaceLines_CharacteristicPointsInvalidDitchPolderSide", "Insteek sloot polderzijde")] - public void Import_FileWithTwoValidLinesAndCharacteristicPointNotOnGeometry_LogInvalidPointDefinition(string fileName, string characteristicPointName) + [TestCase("Slootbodem dijkzijde", "TwoValidSurfaceLines_CharacteristicPointsInvalidBottomDitchDikeSide")] + [TestCase("Slootbodem polderzijde", "TwoValidSurfaceLines_CharacteristicPointsInvalidBottomDitchPolderSide")] + [TestCase("Teen dijk binnenwaarts", "TwoValidSurfaceLines_CharacteristicPointsInvalidDikeToeAtPolder")] + [TestCase("Teen dijk buitenwaarts", "TwoValidSurfaceLines_CharacteristicPointsInvalidDikeToeAtRiver")] + [TestCase("Insteek sloot dijkzijde", "TwoValidSurfaceLines_CharacteristicPointsInvalidDitchDikeSide")] + [TestCase("Insteek sloot polderzijde", "TwoValidSurfaceLines_CharacteristicPointsInvalidDitchPolderSide")] + public void Import_FileWithTwoValidLinesAndCharacteristicPointNotOnGeometry_LogInvalidPointDefinition(string characteristicPointName, string fileName) { // Setup string surfaceLinesPath = Path.Combine(pluginSurfaceLinesTestDataPath, string.Format(surfaceLineFormat, fileName));