// Copyright (C) Stichting Deltares 2024. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI 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.Drawing; using System.IO; using Deltares.Dam.Data; using Deltares.Dam.Data.CsvImporters; using Deltares.Geotechnics.Soils; using Deltares.Standard.EventPublisher; using NUnit.Framework; namespace Deltares.Dam.Tests; [TestFixture] public class CsvImporterTestsNew { private string importFolder; /// /// Setup for whole test fixture /// [SetUp] public void FixtureSetup() { importFolder = Path.Combine(Directory.GetCurrentDirectory(), "TmpImportFiles"); } /// /// Setup for single test /// [SetUp] public void Setup() { if (!Directory.Exists(importFolder)) { Directory.CreateDirectory(importFolder); } } [Test] public void SegmentImporterThrowsArgumentExceptionWhenFileNameIsEmpty() { Assert.That(() => new CsvImporterSegments(""), Throws.ArgumentException); } [Test] public void SegmentImporterThrowsArgumentExceptionWhenFileDoesNotExist() { Assert.That(() => new CsvImporterSegments("bla45se%"), Throws.InstanceOf()); } [Test] public void SegmentImporter1DProfileTest() { const string importFile = "segments.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSegmentsFor1DProfilesFile(testFilePath); var csvImporterSegments = new CsvImporterSegments(testFilePath); IList segmentRecords = csvImporterSegments.ImportedItems; Assert.AreEqual("1", segmentRecords[0].SegmentId); Assert.AreEqual("1DP1", segmentRecords[0].SoilProfileId); Assert.AreEqual(80, segmentRecords[0].Probability); Assert.AreEqual(FailureMechanismSystemType.StabilityInside, segmentRecords[0].SegmentFailureMechanismType); Assert.AreEqual("1", segmentRecords[1].SegmentId); Assert.AreEqual("1", segmentRecords[2].SegmentId); Assert.AreEqual("2", segmentRecords[3].SegmentId); Assert.AreEqual("2", segmentRecords[4].SegmentId); Assert.AreEqual("1DP1", segmentRecords[4].SoilProfileId); Assert.AreEqual(100, segmentRecords[4].Probability); Assert.AreEqual(FailureMechanismSystemType.Piping, segmentRecords[4].SegmentFailureMechanismType); } [Test] public void SegmentImporter2DGeometriesTest() { const string importFile = "segments.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSegmentsFor2DGeometriesFile(testFilePath); var csvImporterSegments = new CsvImporterSegments(testFilePath); IList segmentRecords = csvImporterSegments.ImportedItems; Assert.AreEqual("1", segmentRecords[0].SegmentId); Assert.AreEqual("GeomA", segmentRecords[0].SoilGeometry2DName); Assert.AreEqual(80, segmentRecords[0].Probability); Assert.AreEqual(FailureMechanismSystemType.StabilityInside, segmentRecords[0].SegmentFailureMechanismType); Assert.AreEqual("2", segmentRecords[1].SegmentId); Assert.AreEqual("GeomB", segmentRecords[1].SoilGeometry2DName); Assert.AreEqual(20, segmentRecords[1].Probability); Assert.AreEqual(FailureMechanismSystemType.Piping, segmentRecords[1].SegmentFailureMechanismType); } [Test] public void SegmentImporterIllegalHeaderTest() { const string importFile = "segments.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSegmentsFileWithIllegalHeader(testFilePath); Assert.That(() => new CsvImporterSegments(testFilePath), Throws.InstanceOf()); } [Test] public void SoilProfilesImporterFileWithObsoleteColumnTest() { const string importFile = "soilprofiles.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilProfilesFileWithObsoleteColumns(testFilePath); var csvImporterSoilProfiles = new CsvImporterSoilProfiles(testFilePath); IList soilProfileRecords = csvImporterSoilProfiles.ImportedItems; Assert.AreEqual("1DP1", soilProfileRecords[0].SoilProfileId); Assert.AreEqual(10, soilProfileRecords[0].TopLevel); Assert.AreEqual("HW-OBO", soilProfileRecords[0].SoilName); Assert.AreEqual("1DP1", soilProfileRecords[1].SoilProfileId); Assert.AreEqual(-0.6, soilProfileRecords[1].TopLevel); Assert.AreEqual("HW-DUN", soilProfileRecords[1].SoilName); Assert.AreEqual("1DP2", soilProfileRecords[11].SoilProfileId); Assert.AreEqual(-5.3, soilProfileRecords[11].TopLevel); Assert.AreEqual("Alg-zand (0-30)", soilProfileRecords[11].SoilName); } [Test] public void SoilProfilesImporterCorrectFileTest() { const string importFile = "soilprofiles.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilProfilesFile(testFilePath); var csvImporterSoilProfiles = new CsvImporterSoilProfiles(testFilePath); IList soilProfileRecords = csvImporterSoilProfiles.ImportedItems; Assert.AreEqual("1DP1", soilProfileRecords[0].SoilProfileId); Assert.AreEqual(10, soilProfileRecords[0].TopLevel); Assert.AreEqual("HW-OBO", soilProfileRecords[0].SoilName); Assert.That(soilProfileRecords[0].IsAquifer, Is.False); Assert.AreEqual("1DP1", soilProfileRecords[1].SoilProfileId); Assert.AreEqual(-0.6, soilProfileRecords[1].TopLevel); Assert.AreEqual("HW-DUN", soilProfileRecords[1].SoilName); Assert.That(soilProfileRecords[1].IsAquifer, Is.False); Assert.AreEqual("1DP2", soilProfileRecords[11].SoilProfileId); Assert.AreEqual(-5.3, soilProfileRecords[11].TopLevel); Assert.AreEqual("Alg-zand (0-30)", soilProfileRecords[11].SoilName); Assert.That(soilProfileRecords[11].IsAquifer, Is.True); } [Test] public void SoilProfilesImporterIllegalHeaderTest() { const string importFile = "soilprofiles.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilProfilesFileWithIllegalHeader(testFilePath); Assert.That(() => new CsvImporterSoilProfiles(testFilePath), Throws.InstanceOf()); } [Test] public void SoilProfilesImporterMissingHeaderFieldTest() { const string importFile = "soilprofiles.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilProfilesFileWithIllegalHeaderField(testFilePath); Assert.That(() => new CsvImporterSoilProfiles(testFilePath), Throws.InstanceOf()); } [Test] public void CharacteristicPointsImporterCorrectFileTest() { const string importFile = "characteristicpoints.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateCharacteristicPointsFile(testFilePath); var csvImporterCharacteristicPoints = new CsvImporterCharacteristicPoints(testFilePath); IList characteristicPointsRecords = csvImporterCharacteristicPoints.ImportedItems; CheckCharacteristicPoints(characteristicPointsRecords); } [Test] public void CharacteristicPointsWithLocationIdImporterCorrectFileTest() { const string importFile = "characteristicpoints.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateCharacteristicPointsFileWithLocationId(testFilePath); var csvImporterCharacteristicPoints = new CsvImporterCharacteristicPoints(testFilePath); IList characteristicPointsRecords = csvImporterCharacteristicPoints.ImportedItems; CheckCharacteristicPoints(characteristicPointsRecords); } [Test] public void CharacteristicPointsImporterIllegalHeaderTest() { const string importFile = "characteristicpoints.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateCharacteristicPointsFileWithIllegalHeader(testFilePath); Assert.That(() => new CsvImporterCharacteristicPoints(testFilePath), Throws.InstanceOf()); } [Test] public void SurfaceLinesImporterCorrectFileTest() { const string importFile = "surfacelines.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSurfaceLinesFile(testFilePath); var csvImporterSurfaceLines = new CsvImporterSurfaceLines(testFilePath); IList surfaceLineRecords = csvImporterSurfaceLines.ImportedItems; CheckSurfaceLine(surfaceLineRecords); } [Test] public void SurfaceLinesWithLocationIdImporterCorrectFileTest() { const string importFile = "surfacelines.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSurfaceLinesFileWithLocationId(testFilePath); var csvImporterSurfaceLines = new CsvImporterSurfaceLines(testFilePath); IList surfaceLineRecords = csvImporterSurfaceLines.ImportedItems; CheckSurfaceLine(surfaceLineRecords); } [Test] public void SurfaceLinesImporterIllegalHeaderTest() { const string importFile = "surfacelines.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSurfaceLinesFileWithIllegalHeaders(testFilePath); Assert.That(() => new CsvImporterSurfaceLines(testFilePath), Throws.InstanceOf()); } [Test] public void SurfaceLinesImporterIllegalValuesTest() { const string importFile = "surfacelines.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSurfaceLinesFileWithIllegalValues(testFilePath); var csvImporterSurfaceLines = new CsvImporterSurfaceLines(testFilePath); Assert.AreEqual(1, csvImporterSurfaceLines.ErrorMessages.Count); } [Test] public void LocationImporterCorrectFileTest() { const double tolerance = 0.001; const string importFile = "locations.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateLocationsFileWithObsoleteColumn(testFilePath); var csvImporterLocations = new CsvImporterLocations(testFilePath); IList locationRecords = csvImporterLocations.ImportedItems; Assert.That(locationRecords.Count, Is.EqualTo(2)); Assert.That(locationRecords[1].LocationId, Is.EqualTo("25-2-2-A-1-A")); Assert.That(locationRecords[1].SurfaceLineId, Is.EqualTo("25-2-2-A-1-A")); Assert.That(locationRecords[1].SegmentId, Is.EqualTo("106")); Assert.That(locationRecords[1].GeoX, Is.EqualTo(66586.0).Within(tolerance)); Assert.That(locationRecords[1].GeoY, Is.EqualTo(424173.0).Within(tolerance)); Assert.That(locationRecords[1].XSoilGeometry2DOrigin, Is.EqualTo(2.0).Within(tolerance)); Assert.That(locationRecords[1].PolderLevel, Is.EqualTo(-0.25).Within(tolerance)); Assert.That(locationRecords[1].HeadPl2.Value, Is.EqualTo(0.8727).Within(tolerance)); Assert.That(locationRecords[0].HeadPl3.Value, Is.EqualTo(0.9).Within(tolerance)); Assert.That(locationRecords[0].HeadPl4.Value, Is.EqualTo(0.8).Within(tolerance)); Assert.That(locationRecords[1].DikeEmbankmentMaterial, Is.EqualTo("klei")); Assert.That(locationRecords[1].ShoulderEmbankmentMaterial, Is.EqualTo("klei2")); Assert.That(locationRecords[1].PenetrationLength, Is.EqualTo(1.3).Within(tolerance)); Assert.That(locationRecords[1].TrafficLoad, Is.EqualTo(10).Within(tolerance)); Assert.That(locationRecords[0].TL_DegreeOfConsolidation, Is.EqualTo(10.1).Within(tolerance)); Assert.That(locationRecords[1].TL_DegreeOfConsolidation, Is.EqualTo(55.5).Within(tolerance)); Assert.That(locationRecords[1].MinimalCircleDepth, Is.EqualTo(1.5).Within(tolerance)); Assert.That(locationRecords[1].DampingFactorPl3, Is.EqualTo(30.0).Within(tolerance)); Assert.That(locationRecords[1].DampingFactorPl4, Is.EqualTo(40.0).Within(tolerance)); Assert.That(locationRecords[1].PLLineCreationMethod, Is.EqualTo(PLLineCreationMethod.ExpertKnowledgeRRD)); Assert.That(locationRecords[1].RequiredSafetyFactorPiping, Is.EqualTo(1.2).Within(tolerance)); Assert.That(locationRecords[1].RequiredSafetyFactorStabilityInnerSlope, Is.EqualTo(1.3).Within(tolerance)); Assert.That(locationRecords[1].RequiredSafetyFactorStabilityOuterSlope, Is.EqualTo(1.4).Within(tolerance)); Assert.That(locationRecords[1].UpliftCriterionPiping, Is.EqualTo(1.1).Within(tolerance)); Assert.That(locationRecords[1].UpliftCriterionStability, Is.EqualTo(1.2).Within(tolerance)); Assert.That(locationRecords[1].DistanceToEntryPoint, Is.EqualTo(2.1).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetBelowDikeTopAtRiver, Is.EqualTo(0.5).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetBelowDikeTopAtPolder, Is.EqualTo(0.6).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetBelowShoulderBaseInside, Is.EqualTo(0.1).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetBelowDikeToeAtPolder, Is.EqualTo(0.2).Within(tolerance)); Assert.That(locationRecords[1].StabilityShoulderGrowSlope, Is.EqualTo(2.0).Within(tolerance)); Assert.That(locationRecords[1].StabilityShoulderGrowDeltaX, Is.EqualTo(0.2).Within(tolerance)); Assert.That(locationRecords[1].StabilitySlopeAdaptionDeltaX, Is.EqualTo(0.5).Within(tolerance)); Assert.That(locationRecords[0].SlopeDampingPiezometricHeightPolderSide, Is.EqualTo(0.01).Within(tolerance)); Assert.That(locationRecords[1].SlopeDampingPiezometricHeightPolderSide, Is.EqualTo(0.2).Within(tolerance)); Assert.That(locationRecords[0].StabilityDesignMethod, Is.EqualTo(StabilityDesignMethod.OptimizedSlopeAndShoulderAdaption)); Assert.That(locationRecords[1].StabilityDesignMethod, Is.EqualTo(StabilityDesignMethod.SlopeAdaptionBeforeShoulderAdaption)); Assert.That(locationRecords[0].SlopeAdaptionStartCotangent, Is.EqualTo(3.0).Within(tolerance)); Assert.That(locationRecords[0].SlopeAdaptionEndCotangent, Is.EqualTo(6.0).Within(tolerance)); Assert.That(locationRecords[0].SlopeAdaptionStepCotangent, Is.EqualTo(0.5).Within(tolerance)); Assert.That(locationRecords[1].SlopeAdaptionStartCotangent, Is.EqualTo(4.5).Within(tolerance)); Assert.That(locationRecords[1].SlopeAdaptionEndCotangent, Is.EqualTo(6.5).Within(tolerance)); Assert.That(locationRecords[1].SlopeAdaptionStepCotangent, Is.EqualTo(0.25).Within(tolerance)); Assert.That(locationRecords[0].UseNewDikeTopWidth, Is.True); Assert.That(locationRecords[0].NewDikeTopWidth, Is.EqualTo(1.8).Within(tolerance)); Assert.That(locationRecords[1].UseNewDikeTopWidth, Is.False); Assert.That(locationRecords[1].NewDikeTopWidth, Is.EqualTo(0.8).Within(tolerance)); Assert.That(locationRecords[0].UseNewDikeSlopeInside, Is.True); Assert.That(locationRecords[0].NewDikeSlopeInside, Is.EqualTo(1.9).Within(tolerance)); Assert.That(locationRecords[1].UseNewDikeSlopeInside, Is.False); Assert.That(locationRecords[1].NewDikeSlopeInside, Is.EqualTo(0.9).Within(tolerance)); Assert.That(locationRecords[0].UseNewDikeSlopeOutside, Is.True); Assert.That(locationRecords[0].NewDikeSlopeOutside, Is.EqualTo(2.9).Within(tolerance)); Assert.That(locationRecords[1].UseNewDikeSlopeOutside, Is.False); Assert.That(locationRecords[1].NewDikeSlopeOutside, Is.EqualTo(1.9).Within(tolerance)); Assert.That(locationRecords[0].UseNewShoulderTopSlope, Is.True); Assert.That(locationRecords[0].NewShoulderTopSlope, Is.EqualTo(2.8).Within(tolerance)); Assert.That(locationRecords[1].UseNewShoulderTopSlope, Is.False); Assert.That(locationRecords[1].NewShoulderTopSlope, Is.EqualTo(1.8).Within(tolerance)); Assert.That(locationRecords[0].UseNewShoulderBaseSlope, Is.True); Assert.That(locationRecords[0].NewShoulderBaseSlope, Is.EqualTo(2.7).Within(tolerance)); Assert.That(locationRecords[1].UseNewShoulderBaseSlope, Is.False); Assert.That(locationRecords[1].NewShoulderBaseSlope, Is.EqualTo(1.7).Within(tolerance)); Assert.That(locationRecords[0].UseNewMaxHeightShoulderAsFraction, Is.True); Assert.That(locationRecords[0].NewMaxHeightShoulderAsFraction, Is.EqualTo(0.6).Within(tolerance)); Assert.That(locationRecords[1].UseNewMaxHeightShoulderAsFraction, Is.False); Assert.That(locationRecords[1].NewMaxHeightShoulderAsFraction, Is.EqualTo(0.7).Within(tolerance)); Assert.That(locationRecords[0].UseNewMinDistanceDikeToeStartDitch, Is.True); Assert.That(locationRecords[0].NewMinDistanceDikeToeStartDitch, Is.EqualTo(2.6).Within(tolerance)); Assert.That(locationRecords[1].UseNewMinDistanceDikeToeStartDitch, Is.False); Assert.That(locationRecords[1].NewMinDistanceDikeToeStartDitch, Is.EqualTo(1.6).Within(tolerance)); Assert.That(locationRecords[0].UseNewDitchDefinition, Is.True); Assert.That(locationRecords[0].NewWidthDitchBottom, Is.EqualTo(1.1).Within(tolerance)); Assert.That(locationRecords[0].NewSlopeAngleDitch, Is.EqualTo(1.2).Within(tolerance)); Assert.That(locationRecords[0].NewDepthDitch, Is.EqualTo(1.3).Within(tolerance)); Assert.That(locationRecords[1].UseNewDitchDefinition, Is.False); Assert.That(locationRecords[1].NewWidthDitchBottom, Is.EqualTo(1.4).Within(tolerance)); Assert.That(locationRecords[1].NewSlopeAngleDitch, Is.EqualTo(1.5).Within(tolerance)); Assert.That(locationRecords[1].NewDepthDitch, Is.EqualTo(1.6).Within(tolerance)); Assert.That(locationRecords[0].StabilityZoneType, Is.EqualTo(MStabZonesType.NoZones)); Assert.That(locationRecords[1].StabilityZoneType, Is.EqualTo(MStabZonesType.ForbiddenZone)); Assert.That(locationRecords[0].ForbiddenZoneFactor, Is.EqualTo(0.5).Within(tolerance)); Assert.That(locationRecords[1].ForbiddenZoneFactor, Is.EqualTo(0.9).Within(tolerance)); Assert.That(locationRecords[0].PlLineOffsetBelowDikeCrestMiddle, Is.EqualTo(1.0).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetBelowDikeCrestMiddle, Is.EqualTo(1.1).Within(tolerance)); Assert.That(locationRecords[0].UsePlLineOffsetBelowDikeCrestMiddle, Is.Null); Assert.That(locationRecords[1].UsePlLineOffsetBelowDikeCrestMiddle, Is.Null); Assert.That(locationRecords[0].PlLineOffsetFactorBelowShoulderCrest, Is.EqualTo(0.1).Within(tolerance)); Assert.That(locationRecords[1].PlLineOffsetFactorBelowShoulderCrest, Is.EqualTo(0.11).Within(tolerance)); Assert.That(locationRecords[0].UsePlLineOffsetFactorBelowShoulderCrest, Is.Null); Assert.That(locationRecords[1].UsePlLineOffsetFactorBelowShoulderCrest, Is.Null); Assert.That(locationRecords[0].IntrusionVerticalWaterPressure, Is.EqualTo(IntrusionVerticalWaterPressureType.Standard)); Assert.That(locationRecords[1].IntrusionVerticalWaterPressure, Is.EqualTo(IntrusionVerticalWaterPressureType.SemiTimeDependent)); Assert.That(locationRecords[0].DikeTableHeight, Is.EqualTo(3.5).Within(tolerance)); Assert.That(locationRecords[1].DikeTableHeight, Is.EqualTo(3.5).Within(tolerance)); Assert.That(locationRecords[0].RiverLevel, Is.EqualTo(1.2).Within(tolerance)); Assert.That(locationRecords[1].RiverLevel, Is.EqualTo(2.2).Within(tolerance)); Assert.That(locationRecords[0].RiverLevelLow, Is.EqualTo(1.3).Within(tolerance)); Assert.That(locationRecords[1].RiverLevelLow, Is.EqualTo(2.3).Within(tolerance)); } [Test] public void ScenariosImporterCorrectFileTest() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosFile(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.0, scenarioRecords[0].RiverLevel); Assert.AreEqual(0.680, scenarioRecords[0].RiverLevelLow); Assert.AreEqual(21.110, scenarioRecords[0].DikeTableHeight); Assert.AreEqual(31.600, scenarioRecords[0].RequiredSafetyFactorPiping); Assert.AreEqual(0.0, scenarioRecords[0].RequiredSafetyFactorStabilityInnerSlope); Assert.AreEqual(1.300, scenarioRecords[0].RequiredSafetyFactorStabilityOuterSlope); Assert.AreEqual(1.3, scenarioRecords[0].UpliftCriterionPiping); Assert.AreEqual(0.0, scenarioRecords[0].UpliftCriterionStability); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.0, scenarioRecords[1].RiverLevel); Assert.AreEqual(1.680, scenarioRecords[1].RiverLevelLow); Assert.AreEqual(22.110, scenarioRecords[1].DikeTableHeight); Assert.AreEqual(32.600, scenarioRecords[1].RequiredSafetyFactorPiping); Assert.AreEqual(1.0, scenarioRecords[1].RequiredSafetyFactorStabilityInnerSlope); Assert.AreEqual(1.400, scenarioRecords[1].RequiredSafetyFactorStabilityOuterSlope); Assert.AreEqual(1.3, scenarioRecords[1].UpliftCriterionPiping); Assert.AreEqual(0.0, scenarioRecords[1].UpliftCriterionStability); } [Test] public void ScenariosImporterCorrectFileTestWithOffsetData() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosFileWithOffsetData(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.0, scenarioRecords[0].RiverLevel); Assert.AreEqual(0.680, scenarioRecords[0].RiverLevelLow); Assert.AreEqual(21.110, scenarioRecords[0].DikeTableHeight); Assert.AreEqual(31.600, scenarioRecords[0].RequiredSafetyFactorPiping); Assert.AreEqual(0.0, scenarioRecords[0].RequiredSafetyFactorStabilityInnerSlope); Assert.AreEqual(1.300, scenarioRecords[0].RequiredSafetyFactorStabilityOuterSlope); Assert.AreEqual(1.3, scenarioRecords[0].UpliftCriterionPiping); Assert.AreEqual(0.0, scenarioRecords[0].UpliftCriterionStability); Assert.AreEqual(1.1, scenarioRecords[0].PlLineOffsetBelowDikeTopAtRiver); Assert.AreEqual(2.2, scenarioRecords[0].PlLineOffsetBelowDikeTopAtPolder); Assert.AreEqual(3.3, scenarioRecords[0].PlLineOffsetBelowShoulderBaseInside); Assert.AreEqual(4.4, scenarioRecords[0].PlLineOffsetBelowDikeToeAtPolder); Assert.AreEqual(true, scenarioRecords[0].UsePlLineOffsetBelowDikeCrestMiddle); Assert.AreEqual(5.5, scenarioRecords[0].PlLineOffsetBelowDikeCrestMiddle); Assert.AreEqual(false, scenarioRecords[0].UsePlLineOffsetFactorBelowShoulderCrest); Assert.AreEqual(6.6, scenarioRecords[0].PlLineOffsetFactorBelowShoulderCrest); Assert.AreEqual(7.7, scenarioRecords[0].HeadPl3); Assert.AreEqual(8.8, scenarioRecords[0].HeadPl4); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.0, scenarioRecords[1].RiverLevel); Assert.AreEqual(1.680, scenarioRecords[1].RiverLevelLow); Assert.AreEqual(22.110, scenarioRecords[1].DikeTableHeight); Assert.AreEqual(32.600, scenarioRecords[1].RequiredSafetyFactorPiping); Assert.AreEqual(1.0, scenarioRecords[1].RequiredSafetyFactorStabilityInnerSlope); Assert.AreEqual(1.400, scenarioRecords[1].RequiredSafetyFactorStabilityOuterSlope); Assert.AreEqual(1.3, scenarioRecords[1].UpliftCriterionPiping); Assert.AreEqual(0.0, scenarioRecords[1].UpliftCriterionStability); Assert.AreEqual(0.1, scenarioRecords[1].PlLineOffsetBelowDikeTopAtRiver); Assert.AreEqual(0.2, scenarioRecords[1].PlLineOffsetBelowDikeTopAtPolder); Assert.AreEqual(0.3, scenarioRecords[1].PlLineOffsetBelowShoulderBaseInside); Assert.AreEqual(0.4, scenarioRecords[1].PlLineOffsetBelowDikeToeAtPolder); Assert.AreEqual(false, scenarioRecords[1].UsePlLineOffsetBelowDikeCrestMiddle); Assert.AreEqual(0.5, scenarioRecords[1].PlLineOffsetBelowDikeCrestMiddle); Assert.AreEqual(true, scenarioRecords[1].UsePlLineOffsetFactorBelowShoulderCrest); Assert.AreEqual(0.6, scenarioRecords[1].PlLineOffsetFactorBelowShoulderCrest); Assert.AreEqual(0.7, scenarioRecords[1].HeadPl3); Assert.AreEqual(0.8, scenarioRecords[1].HeadPl4); } [Test] public void ScenariosImporterIllegalHeaderTest() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosFileWithIllegalHeader(testFilePath); Assert.That(() => new CsvImporterScenarios(testFilePath), Throws.InstanceOf()); } [Test] public void ScenariosImporterIllegalValuesTest() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosFileWithIllegalValues(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.IsEmpty(scenarioRecords); Assert.AreEqual(2, csvImporterScenarios.ErrorMessages.Count); } [Test] public void ScenariosImporterWithHeadPl3AndHeadPl4Test() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosWithHeadPl3AndHeadPl4File(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.001, scenarioRecords[0].HeadPl3); Assert.AreEqual(0.002, scenarioRecords[0].HeadPl4); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.003, scenarioRecords[1].HeadPl3); Assert.AreEqual(0.004, scenarioRecords[1].HeadPl4); } [Test] public void ScenariosImporterWithHeadPl3AndHeadPl4OldFormatTest() { const string importFile = "scenarios.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosWithHeadPl3AndHeadPl4OldFormatFile(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.011, scenarioRecords[0].HeadPl3); Assert.AreEqual(0.012, scenarioRecords[0].HeadPl4); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.013, scenarioRecords[1].HeadPl3); Assert.AreEqual(0.014, scenarioRecords[1].HeadPl4); } [Test] public void ScenariosImporterWithPolderLevelTest() { const string fileName = "polderlevel.csv"; string testFilePath = Path.Combine(importFolder, fileName); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosWithPolderLevelFile(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.001, scenarioRecords[0].PolderLevel); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.003, scenarioRecords[1].PolderLevel); } [Test] public void ScenariosImporterWithHeadPL2Test() { const string fileName = "headPL2.csv"; string testFilePath = Path.Combine(importFolder, fileName); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateScenariosWithHeadPL2File(testFilePath); var csvImporterScenarios = new CsvImporterScenarios(testFilePath); IList scenarioRecords = csvImporterScenarios.ImportedItems; Assert.AreEqual("D1", scenarioRecords[0].LocationId); Assert.AreEqual("1", scenarioRecords[0].LocationScenarioId); Assert.AreEqual(0.001, scenarioRecords[0].HeadPl2); Assert.AreEqual("D2", scenarioRecords[1].LocationId); Assert.AreEqual("1", scenarioRecords[1].LocationScenarioId); Assert.AreEqual(0.003, scenarioRecords[1].HeadPl2); } [Test] public void AllCsvTimingTest() { DataEventPublisher.InvokeWithoutPublishingEvents(() => { DateTime start = DateTime.Now; const string testDataFolder = @"TestData\CsvData\ImporterTest"; var csvImporterSurfaceLines = new CsvImporterSurfaceLines(testDataFolder + "\\surfacelines.csv"); var csvImporterCharacteristicPoints = new CsvImporterCharacteristicPoints(testDataFolder + "\\characteristicpoints.csv"); var csvImporterSoilProfiles = new CsvImporterSoilProfiles(testDataFolder + "\\soilprofiles.csv"); var csvImporterSegments = new CsvImporterSegments(testDataFolder + "\\segments.csv"); DateTime end = DateTime.Now; TimeSpan elapsed = end - start; // Note: numbers are the number of records read, not the number of Dam data objects. Assert.AreEqual(3306, csvImporterSurfaceLines.ImportedItems.Count); Assert.AreEqual(3305, csvImporterCharacteristicPoints.ImportedItems.Count); Assert.AreEqual(23554, csvImporterSoilProfiles.ImportedItems.Count); Assert.AreEqual(7672, csvImporterSegments.ImportedItems.Count); TimeSpan maxTime = TimeSpan.FromSeconds(6); // This is the time on the buildserver; local time was 2 seconds; // enlarged from 4 to 6 sec because code coverage was turned on on build server Assert.Less(elapsed, maxTime); }); } [Test] public void SoilsImporterCorrectFileWithOnlyRequiredColumnDefinedTest() { const string importFile = "soils.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateMinimalSoilsFile(testFilePath); var csvImporterSoils = new CsvImporterSoils(testFilePath); Assert.That(csvImporterSoils.ImportedItems.Count, Is.EqualTo(2)); IList soilRecords = csvImporterSoils.ImportedItems; CsvImporterSoils.SoilRecord soilRecord = soilRecords[0]; Assert.That(soilRecord.SoilName, Is.EqualTo("Klei")); Assert.That(soilRecord.SoilColor, Is.EqualTo(Color.FromArgb(255, 255, 255))); Assert.That(soilRecord.SoilType, Is.EqualTo(SoilType.Clay)); Assert.That(soilRecord.SaturatedUnitWeight, Is.Null); Assert.That(soilRecord.UnsaturatedUnitWeight, Is.Null); Assert.That(soilRecord.Cohesion, Is.Null); Assert.That(soilRecord.FrictionAngle, Is.Null); Assert.That(soilRecord.DiameterD70, Is.Null); Assert.That(soilRecord.PermeabilityX, Is.Null); Assert.That(soilRecord.ShearStrengthModel, Is.EqualTo((ShearStrengthModel) 0)); Assert.That(soilRecord.StrengthIncreaseExponent, Is.Null); Assert.That(soilRecord.RatioSuPc, Is.Null); Assert.That(soilRecord.UsePop, Is.False); Assert.That(soilRecord.Pop, Is.Null); soilRecord = soilRecords[1]; Assert.That(soilRecord.SoilName, Is.EqualTo("Veen")); Assert.That(soilRecord.SoilColor, Is.EqualTo(Color.FromArgb(164, 255, 166))); Assert.That(soilRecord.SoilType, Is.EqualTo(SoilType.Peat)); Assert.That(soilRecord.SaturatedUnitWeight, Is.Null); Assert.That(soilRecord.UnsaturatedUnitWeight, Is.Null); Assert.That(soilRecord.Cohesion, Is.Null); Assert.That(soilRecord.FrictionAngle, Is.Null); Assert.That(soilRecord.DiameterD70, Is.Null); Assert.That(soilRecord.PermeabilityX, Is.Null); Assert.That(soilRecord.ShearStrengthModel, Is.EqualTo((ShearStrengthModel) 0)); Assert.That(soilRecord.StrengthIncreaseExponent, Is.Null); Assert.That(soilRecord.RatioSuPc, Is.Null); Assert.That(soilRecord.UsePop, Is.False); Assert.That(soilRecord.Pop, Is.Null); } [Test] public void SoilsImporterCorrectFileWithAllColumnsDefinedTest() { const string importFile = "soils.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateFullSoilsFile(testFilePath); var csvImporterSoils = new CsvImporterSoils(testFilePath); Assert.That(csvImporterSoils.ImportedItems.Count, Is.EqualTo(3)); IList soilRecords = csvImporterSoils.ImportedItems; CsvImporterSoils.SoilRecord soilRecord = soilRecords[0]; Assert.That(soilRecord.SoilName, Is.EqualTo("Zand")); Assert.That(soilRecord.SoilType, Is.EqualTo(SoilType.Sand)); Assert.That(soilRecord.SoilColor, Is.EqualTo(Color.FromArgb(166, 235, 252))); Assert.That(soilRecord.SaturatedUnitWeight, Is.EqualTo(20.000)); Assert.That(soilRecord.UnsaturatedUnitWeight, Is.EqualTo(18.000)); Assert.That(soilRecord.Cohesion, Is.EqualTo(0.000)); Assert.That(soilRecord.FrictionAngle, Is.EqualTo(30.000)); Assert.That(soilRecord.DiameterD70, Is.EqualTo(210.00)); Assert.That(soilRecord.PermeabilityX, Is.EqualTo(0.001)); Assert.That(soilRecord.ShearStrengthModel, Is.EqualTo(ShearStrengthModel.CPhi)); Assert.That(soilRecord.StrengthIncreaseExponent, Is.EqualTo(0.700)); Assert.That(soilRecord.RatioSuPc, Is.EqualTo(0.220)); Assert.That(soilRecord.UsePop, Is.False); Assert.That(soilRecord.Pop, Is.EqualTo(10.000)); Assert.That(soilRecord.SigmaTauCurveName, Is.EqualTo("")); soilRecord = soilRecords[1]; Assert.That(soilRecord.SoilName, Is.EqualTo("Klei")); Assert.That(soilRecord.SoilColor, Is.EqualTo(Color.FromArgb(255, 255, 255))); Assert.That(soilRecord.SoilType, Is.EqualTo(SoilType.Clay)); Assert.That(soilRecord.SaturatedUnitWeight, Is.EqualTo(17.500)); Assert.That(soilRecord.UnsaturatedUnitWeight, Is.EqualTo(17.500)); Assert.That(soilRecord.Cohesion, Is.EqualTo(3.500)); Assert.That(soilRecord.FrictionAngle, Is.EqualTo(18.500)); Assert.That(soilRecord.DiameterD70, Is.EqualTo(210.00)); Assert.That(soilRecord.PermeabilityX, Is.EqualTo(0.001)); Assert.That(soilRecord.ShearStrengthModel, Is.EqualTo(ShearStrengthModel.StressTable)); Assert.That(soilRecord.StrengthIncreaseExponent, Is.EqualTo(0.700)); Assert.That(soilRecord.RatioSuPc, Is.EqualTo(0.220)); Assert.That(soilRecord.UsePop, Is.False); Assert.That(soilRecord.Pop, Is.EqualTo(10.000)); Assert.That(soilRecord.SigmaTauCurveName, Is.EqualTo("CurveKlei")); soilRecord = soilRecords[2]; Assert.That(soilRecord.SoilName, Is.EqualTo("Veen")); Assert.That(soilRecord.SoilColor, Is.EqualTo(Color.FromArgb(164, 255, 166))); Assert.That(soilRecord.SoilType, Is.EqualTo(SoilType.Peat)); Assert.That(soilRecord.SaturatedUnitWeight, Is.EqualTo(11.000)); Assert.That(soilRecord.UnsaturatedUnitWeight, Is.EqualTo(11.000)); Assert.That(soilRecord.Cohesion, Is.EqualTo(2.000)); Assert.That(soilRecord.FrictionAngle, Is.EqualTo(20.500)); Assert.That(soilRecord.DiameterD70, Is.EqualTo(210.00)); Assert.That(soilRecord.PermeabilityX, Is.EqualTo(0.001)); Assert.That(soilRecord.ShearStrengthModel, Is.EqualTo(ShearStrengthModel.CuCalculated)); Assert.That(soilRecord.StrengthIncreaseExponent, Is.EqualTo(0.700)); Assert.That(soilRecord.RatioSuPc, Is.EqualTo(0.220)); Assert.That(soilRecord.UsePop, Is.False); Assert.That(soilRecord.Pop, Is.EqualTo(10.000)); Assert.That(soilRecord.SigmaTauCurveName, Is.EqualTo("")); } [Test] public void SoilsImporterWithIllegalHeaderTest() { const string importFile = "soils.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilProfilesFileWithIllegalHeader(testFilePath); Assert.That(() => new CsvImporterSoils(testFilePath), Throws.InstanceOf().With.Message.Contains("The header misses the field: soil_type")); } [Test] public void SoilsImporterIllegalValuesTest() { const string importFile = "soils.csv"; string testFilePath = Path.Combine(importFolder, importFile); if (File.Exists(testFilePath)) { File.Delete(testFilePath); } CreateSoilsFileWithIllegalValues(testFilePath); var csvImporterSoils = new CsvImporterSoils(testFilePath); IList scenarioRecords = csvImporterSoils.ImportedItems; Assert.IsEmpty(scenarioRecords); Assert.AreEqual(3, csvImporterSoils.ErrorMessages.Count); } /// /// Create csv file with segments containing 1d soilprofiles /// /// private static void CreateSegmentsFor1DProfilesFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("segment_id;soilprofile_id;probability;calculation_type"); writer.WriteLine("1;1DP1;80;Stability"); writer.WriteLine("1;1DP2;20;Stability"); writer.WriteLine("1;1DP2;100;Piping"); writer.WriteLine("2;1DP2;100;Stability"); writer.WriteLine("2;1DP1;100;Piping"); } /// /// Create csv file with segments containing 2d geometries /// /// private static void CreateSegmentsFor2DGeometriesFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("segment_id;soilgeometry2D_name;probability;calculation_type"); writer.WriteLine("1;GeomA;80;Stability"); writer.WriteLine("2;GeomB;20;Piping"); } /// /// Create csv file with segments containing error header /// /// private static void CreateSegmentsFileWithIllegalHeader(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("segment_id;soilgeometry2D_name;soilprofile_id;probability;calculation_type"); writer.WriteLine("1;GeomA;80;Stability"); writer.WriteLine("1;GeomB;20;Stability"); } private static void CreateSoilProfilesFileWithObsoleteColumns(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soilprofile_id;top_level;soil_name;soiltype;is_aquifer"); writer.WriteLine("1DP1;10;HW-OBO;zand;FALSE;"); writer.WriteLine("1DP1;-0.6;HW-DUN;veen;FALSE;"); writer.WriteLine("1DP1;-1.8;HW-DUOzand;veen;FALSE;"); writer.WriteLine("1DP1;-2.8;HW-HVN;zand;FALSE;"); writer.WriteLine("1DP1;-4;HW-HVN;zand;FALSE;"); writer.WriteLine("1DP1;-5;Alg-zand (0-30);zand;TRUE;"); writer.WriteLine("1DP2;10;HW-OBO;zand;FALSE;"); writer.WriteLine("1DP2;-0.7;HW-DUN;veen;FALSE;"); writer.WriteLine("1DP2;-1.5;HW-DUOzand;veen;FALSE;"); writer.WriteLine("1DP2;-2.4;HW-HVN;zand;FALSE;"); writer.WriteLine("1DP2;-4.3;HW-HVN;zand;FALSE;"); writer.WriteLine("1DP2;-5.3;Alg-zand (0-30);zand;TRUE;"); } private static void CreateSoilProfilesFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soilprofile_id;top_level;soil_name;is_aquifer"); writer.WriteLine("1DP1;10;HW-OBO;False"); writer.WriteLine("1DP1;-0.6;HW-DUN;False"); writer.WriteLine("1DP1;-1.8;HW-DUOzand;True"); writer.WriteLine("1DP1;-2.8;HW-HVN;False"); writer.WriteLine("1DP1;-4;HW-HVN;False"); writer.WriteLine("1DP1;-5;Alg-zand (0-30);True"); writer.WriteLine("1DP2;10;HW-OBO;False"); writer.WriteLine("1DP2;-0.7;HW-DUN;False"); writer.WriteLine("1DP2;-1.5;HW-DUOzand;True"); writer.WriteLine("1DP2;-2.4;HW-HVN;False"); writer.WriteLine("1DP2;-4.3;HW-HVN;False"); writer.WriteLine("1DP2;-5.3;Alg-zand (0-30);True"); } private static void CreateFullSoilsFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soil_name;soil_color;soil_type;saturated_unit_weight;unsaturated_unit_weight;cohesion;friction_angle;diameter_d70;permeability_x;shear_strength_model;strength_increase_exponent;ratio_su_pc;use_pop;pop;sigma_tau_curve_name"); writer.WriteLine("Zand;#A6EBFC;Sand;20.000;18.000;0.000;30.000;210.00;0.001;CPhi;0.700;0.220;False;10.000;"); writer.WriteLine("Klei;#FFFFFF;Clay;17.500;17.500;3.500;18.500;210.00;0.001;SigmaTauCurve;0.700;0.220;False;10.000;CurveKlei"); writer.WriteLine("Veen;#A4FFA6;Peat;11.000;11.000;2.000;20.500;210.00;0.001;CuCalculated;0.700;0.220;False;10.000;"); } private static void CreateMinimalSoilsFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soil_name;soil_color;soil_type"); writer.WriteLine("Klei;#FFFFFF;Clay"); writer.WriteLine("Veen;#A4FFA6;Peat"); } private static void CreateSoilsFileWithIllegalValues(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soil_name;soil_color;soil_type;saturated_unit_weight;unsaturated_unit_weight;cohesion;friction_angle;diameter_d70;permeability_x;shear_strength_model;strength_increase_exponent;ratio_su_pc;use_pop;pop"); writer.WriteLine("Zand;#A6EBFC;Zand;20.000;18.000;0.000;30.000;210.00;0.001;None;;;0;10.000"); writer.WriteLine("Klei;#FFFFFF;Clay;17.500;17.500;3.500;18.500;210.00;0.001;None;null;;0;10.000"); writer.WriteLine("Veen;#A4FFA6;Peat;11.000;11.000;2.000;20.500;210.00;0.001;None;;;0;10.000"); } private static void CreateSoilProfilesFileWithIllegalHeader(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soilprofile_id;soil_name"); writer.WriteLine("1DP1;10;HW-OBO"); } private static void CreateSoilProfilesFileWithIllegalHeaderField(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("soilprofile_id;soil_name;aaa;bbb;"); writer.WriteLine("1DP1;10;HW-OBO"); } private static void CreateCharacteristicPointsFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "Profielnaam;X_Maaiveld binnenwaarts;Y_Maaiveld binnenwaarts;Z_Maaiveld binnenwaarts;X_Insteek sloot polderzijde;Y_Insteek sloot polderzijde;Z_Insteek sloot polderzijde;X_Slootbodem polderzijde;Y_Slootbodem polderzijde;Z_Slootbodem polderzijde;X_Slootbodem dijkzijde;Y_Slootbodem dijkzijde;Z_Slootbodem dijkzijde;X_Insteek sloot dijkzijde;Y_Insteek sloot dijkzijde;Z_Insteek sloot dijkzijde;X_Teen dijk binnenwaarts;Y_Teen dijk binnenwaarts;Z_Teen dijk binnenwaarts;X_Kruin binnenberm;Y_Kruin binnenberm;Z_Kruin binnenberm;X_Insteek binnenberm;Y_Insteek binnenberm;Z_Insteek binnenberm;X_Kruin binnentalud;Y_Kruin binnentalud;Z_Kruin binnentalud;X_Verkeersbelasting kant binnenwaarts;Y_Verkeersbelasting kant binnenwaarts;Z_Verkeersbelasting kant binnenwaarts;X_Verkeersbelasting kant buitenwaarts;Y_Verkeersbelasting kant buitenwaarts;Z_Verkeersbelasting kant buitenwaarts;X_Kruin buitentalud;Y_Kruin buitentalud;Z_Kruin buitentalud;X_Insteek buitenberm;Y_Insteek buitenberm;Z_Insteek buitenberm;X_Kruin buitenberm;Y_Kruin buitenberm;Z_Kruin buitenberm;X_Teen dijk buitenwaarts;Y_Teen dijk buitenwaarts;Z_Teen dijk buitenwaarts;X_Maaiveld buitenwaarts;Y_Maaiveld buitenwaarts;Z_Maaiveld buitenwaarts;X_Dijktafelhoogte;Y_Dijktafelhoogte;Z_Dijktafelhoogte;Volgnummer"); writer.WriteLine( "D1;117.94;0;0.12;-1;-1;-1;73.99;0;-1.0;72.55;0;-1.46;67.9;0;1.07;63.31;0;1.36;-1;-1;-1;-1;-1;-1;55.17;0;4.46;54.25;0;4.69;51.75;0;4.662;50.11;0;4.46;40.48;0;1.94;32.21;0;1.67;31.6;0;1.3;0;0;0.68;52.63;0;4.77;1"); } private static void CreateCharacteristicPointsFileWithLocationId(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "LocationId;X_Maaiveld binnenwaarts;Y_Maaiveld binnenwaarts;Z_Maaiveld binnenwaarts;X_Insteek sloot polderzijde;Y_Insteek sloot polderzijde;Z_Insteek sloot polderzijde;X_Slootbodem polderzijde;Y_Slootbodem polderzijde;Z_Slootbodem polderzijde;X_Slootbodem dijkzijde;Y_Slootbodem dijkzijde;Z_Slootbodem dijkzijde;X_Insteek sloot dijkzijde;Y_Insteek sloot dijkzijde;Z_Insteek sloot dijkzijde;X_Teen dijk binnenwaarts;Y_Teen dijk binnenwaarts;Z_Teen dijk binnenwaarts;X_Kruin binnenberm;Y_Kruin binnenberm;Z_Kruin binnenberm;X_Insteek binnenberm;Y_Insteek binnenberm;Z_Insteek binnenberm;X_Kruin binnentalud;Y_Kruin binnentalud;Z_Kruin binnentalud;X_Verkeersbelasting kant binnenwaarts;Y_Verkeersbelasting kant binnenwaarts;Z_Verkeersbelasting kant binnenwaarts;X_Verkeersbelasting kant buitenwaarts;Y_Verkeersbelasting kant buitenwaarts;Z_Verkeersbelasting kant buitenwaarts;X_Kruin buitentalud;Y_Kruin buitentalud;Z_Kruin buitentalud;X_Insteek buitenberm;Y_Insteek buitenberm;Z_Insteek buitenberm;X_Kruin buitenberm;Y_Kruin buitenberm;Z_Kruin buitenberm;X_Teen dijk buitenwaarts;Y_Teen dijk buitenwaarts;Z_Teen dijk buitenwaarts;X_Maaiveld buitenwaarts;Y_Maaiveld buitenwaarts;Z_Maaiveld buitenwaarts;X_Dijktafelhoogte;Y_Dijktafelhoogte;Z_Dijktafelhoogte;Volgnummer"); writer.WriteLine( "D1;117.94;0;0.12;-1;-1;-1;73.99;0;-1.0;72.55;0;-1.46;67.9;0;1.07;63.31;0;1.36;-1;-1;-1;-1;-1;-1;55.17;0;4.46;54.25;0;4.69;51.75;0;4.662;50.11;0;4.46;40.48;0;1.94;32.21;0;1.67;31.6;0;1.3;0;0;0.68;52.63;0;4.77;1"); } private static void CreateCharacteristicPointsFileWithIllegalHeader(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "Profielnaam;X_Maaiveld binnenwaarts;Z_Maaiveld binnenwaarts;X_Insteek sloot polderzijde;Y_Insteek sloot polderzijde;Z_Insteek sloot polderzijde;X_Slootbodem polderzijde;Y_Slootbodem polderzijde;Z_Slootbodem polderzijde;X_Slootbodem dijkzijde;Y_Slootbodem dijkzijde;Z_Slootbodem dijkzijde;X_Insteek sloot dijkzijde;Y_Insteek_sloot dijkzijde;Z_Insteek sloot dijkzijde;X_Teen dijk binnenwaarts;Y_Teen dijk binnenwaarts;Z_Teen dijk binnenwaarts;X_Kruin binnenberm;Y_Kruin binnenberm;Z_Kruin binnenberm;X_Insteek binnenberm;Y_Insteek binnenberm;Z_Insteek binnenberm;X_Kruin binnentalud;Y_Kruin binnentalud;Z_Kruin binnentalud;X_Verkeersbelasting kant binnenwaarts;Y_Verkeersbelasting kant binnenwaarts;Z_Verkeersbelasting kant binnenwaarts;X_Verkeersbelasting kant buitenwaarts;Y_Verkeersbelasting kant buitenwaarts;Z_Verkeersbelasting kant buitenwaarts;X_Kruin buitentalud;Y_Kruin buitentalud;Z_Kruin buitentalud;X_Insteek buitenberm;Y_Insteek buitenberm;Z_Insteek buitenberm;X_Kruin buitenberm;Y_Kruin buitenberm;Z_Kruin buitenberm;X_Teen dijk buitenwaarts;Y_Teen dijk buitenwaarts;Z_Teen dijk buitenwaarts;X_Maaiveld buitenwaarts;Y_Maaiveld buitenwaarts;Z_Maaiveld buitenwaarts;X_Dijktafelhoogte;Y_Dijktafelhoogte;Z_Dijktafelhoogte;Volgnummer"); writer.WriteLine( "D1;117.94;0;0.12;-1;-1;-1;73.99;0;-1.0;72.55;0;-1.46;67.9;0;1.07;63.31;0;1.36;-1;-1;-1;-1;-1;-1;55.17;0;4.46;54.25;0;4.69;51.75;0;4.662;50.11;0;4.46;40.48;0;1.94;32.21;0;1.67;31.6;0;1.3;0;0;0.68;52.63;0;4.77;1"); } private static void CreateSurfaceLinesFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "Profielnaam;Geologischprofiel;X_GridPoint;Y_GridPoint;ScenarioClusterID;X1;Y1;Z1;.....;Xn;Yn;Zn;(Profiel)"); writer.WriteLine( "D1;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610;32.210;0.000;1.670;35.580;0.000;1.580;40.480;0.000;1.940;47.860;0.000;3.790;50.110;0.000;4.460;51.750;0.000;4.662;52.630;0.000;4.770;54.250;0.000;4.690;55.170;0.000;4.460;58.850;0.000;2.980;60.290;0.000;2.460;63.310;0.000;1.360;67.900;0.000;1.070;69.410;0.000;0.600;69.800;0.000;0.480;70.530;0.000;0.000;70.820;0.000;-0.190;71.550;0.000;-0.600;72.370;0.000;-1.060;72.380;0.000;-1.170;72.550;0.000;-1.460;73.860;0.000;-1.390;73.990;0.000;-1.0;74.570;0.000;-0.840;74.970;0.000;-0.600;76.170;0.000;0.110;86.660;0.000;0.270;103.280;0.000;0.220;117.940;0.000;0.120"); writer.WriteLine( "D2;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610"); } private static void CreateSurfaceLinesFileWithLocationId(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "LocationId;Geologischprofiel;X_GridPoint;Y_GridPoint;ScenarioClusterID;X1;Y1;Z1;.....;Xn;Yn;Zn;(Profiel)"); writer.WriteLine( "D1;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610;32.210;0.000;1.670;35.580;0.000;1.580;40.480;0.000;1.940;47.860;0.000;3.790;50.110;0.000;4.460;51.750;0.000;4.662;52.630;0.000;4.770;54.250;0.000;4.690;55.170;0.000;4.460;58.850;0.000;2.980;60.290;0.000;2.460;63.310;0.000;1.360;67.900;0.000;1.070;69.410;0.000;0.600;69.800;0.000;0.480;70.530;0.000;0.000;70.820;0.000;-0.190;71.550;0.000;-0.600;72.370;0.000;-1.060;72.380;0.000;-1.170;72.550;0.000;-1.460;73.860;0.000;-1.390;73.990;0.000;-1.0;74.570;0.000;-0.840;74.970;0.000;-0.600;76.170;0.000;0.110;86.660;0.000;0.270;103.280;0.000;0.220;117.940;0.000;0.120"); writer.WriteLine( "D2;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610"); } private static void CreateSurfaceLinesFileWithIllegalValues(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "Profielnaam;Geologischprofiel;X_GridPoint;Y_GridPoint;ScenarioClusterID;X1;Y1;Z1;.....;Xn;Yn;Zn;(Profiel)"); writer.WriteLine( "D1;;AS63.310;Bw0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.0as00;1.300;31.730;0.000;1.610;32.210;0.000;1.670;35.580;0.000;1.580;40.480;0.000;1.940;47.860;0.000;3.790;50.110;0.000;4.460;51.750;0.000;4.662;52.630;0.000;4.770;54.250;0.000;4.690;55.170;0.000;4.460;58.850;0.000;2.980;60.290;0.000;2.460;63.310;0.000;1.360;67.900;0.000;1.070;69.410;0.000;0.600;69.800;0.000;0.480;70.530;0.000;0.000;70.820;0.000;-0.190;71.550;0.000;-0.600;72.370;0.000;-1.060;72.380;0.000;-1.170;72.550;0.000;-1.460;73.860;0.000;-1.390;73.990;0.000;-1.0;74.570;0.000;-0.840;74.970;0.000;-0.600;76.170;0.000;0.110;86.660;0.000;0.270;103.280;0.000;0.220;117.940;0.000;0.120"); writer.WriteLine( "D2;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610"); } private static void CreateSurfaceLinesFileWithIllegalHeaders(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "Proflnaam;Geologischprofiel;X_GridPoint;Y_GridPoint;ScenarioClusterID;X1;Y1;Z1;.....;Xn;Yn;Zn;(Profiel)"); writer.WriteLine( "D1;;AS63.310;Bw0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.0as00;1.300;31.730;0.000;1.610;32.210;0.000;1.670;35.580;0.000;1.580;40.480;0.000;1.940;47.860;0.000;3.790;50.110;0.000;4.460;51.750;0.000;4.662;52.630;0.000;4.770;54.250;0.000;4.690;55.170;0.000;4.460;58.850;0.000;2.980;60.290;0.000;2.460;63.310;0.000;1.360;67.900;0.000;1.070;69.410;0.000;0.600;69.800;0.000;0.480;70.530;0.000;0.000;70.820;0.000;-0.190;71.550;0.000;-0.600;72.370;0.000;-1.060;72.380;0.000;-1.170;72.550;0.000;-1.460;73.860;0.000;-1.390;73.990;0.000;-1.0;74.570;0.000;-0.840;74.970;0.000;-0.600;76.170;0.000;0.110;86.660;0.000;0.270;103.280;0.000;0.220;117.940;0.000;0.120"); writer.WriteLine( "D2;;63.310;0.000;1;0.000;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;0.000;1.610"); } private static void CreateLocationsFileWithObsoleteColumn(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "location_id;surfaceline_id;segment_id;geo_x;geo_y;x_soilgeometry2D_origin;Pl1_id;polderlevel;polderlevellow;head_pl2;head_pl3;head_pl4;Grass_quality;Direction;Ophoogmateriaaldijk;Ophoogmateriaalberm;Sheetpile_x;Sheetpile_y;Sheetpile_z;Sheetpile_length;use_original_plline_assignments;PenetrationLength;TrafficLoad;minimal_circle_depth;dempingsfactor_pl3;dempingsfactor_pl4;PLLineCreationMethod;level_reduction_inside;level_reduction_outside;layer_height_distribution;layer_height_deviation;safety_factor_piping;safety_factor_stability_inner_slope;safety_factor_stability_outer_slope;probability_of_failure_stability_innerslope;probability_of_failure_stability_outerslope;probability_of_failure_piping;uplift_criterion_piping;uplift_criterion_stability;Materiaaltypedijk;bp_tp;bp_hbp;bp_lbp;Baggerdiepte;distance_to_entry_point;PLLineOffsetBelowDikeTopAtRiver;PLLineOffsetBelowDikeTopAtPolder;PLLineOffsetBelowShoulderBaseInside;PLLineOffsetBelowDikeToeAtPolder;PLLineOffsetDryBelowDikeTopAtRiver;PLLineOffsetDryBelowDikeTopAtPolder;PLLineOffsetDryBelowShoulderBaseInside;PLLineOffsetDryBelowDikeToeAtPolder;StabilityShoulderGrowSlope;StabilityShoulderGrowDeltaX;StabilitySlopeAdaptionDeltaX;detrimentfactor;dike_table_height;SlopeDampingPiezometricHeightPolderSide;StabilityDesignMethod;SlopeAdaptionStartCotangent;SlopeAdaptionEndCotangent;SlopeAdaptionStepCotangent; UseNewDikeTopWidth; NewDikeTopWidth;UseNewDikeSlopeInside;NewDikeSlopeInside;UseNewDikeSlopeOutside;NewDikeSlopeOutside;UseNewShoulderTopSlope;NewShoulderTopSlope;UseNewShoulderBaseSlope;NewShoulderBaseSlope;UseNewMaxHeightShoulderAsFraction;NewMaxHeightShoulderAsFraction;UseNewMinDistanceDikeToeStartDitch;NewMinDistanceDikeToeStartDitch;UseNewDitchDefinition;NewWidthDitchBottom;newSlopeAngleDitch;NewDepthDitch;ZoneType;ForbiddenZoneFactor;ZoneAreaRestSlopeCrestWidth;PLLineOffsetBelowDikeCrestMiddle;PLLineOffsetFactorBelowShoulderCrest;UsePLLineOffsetDryBelowDikeCrestMiddle;PLLineOffsetDryBelowDikeCrestMiddle;UsePLLineOffsetDryFactorBelowShoulderCrest;PLLineOffsetDryFactorBelowShoulderCrest;IntrusionVerticalWaterPressure;TL_DegreeOfConsolidation;water_height;water_height_low;water_height_decimerings_hoogte;max_waterheight"); writer.WriteLine( "16-1-1-C-3-Z;16-1-1-C-3-Z;1043;124330;441312;1;16-1-1-C-3-Z;0.9;0.2;13.056;0.9;0.8;1;1;klei;klei2;1;2;3;12;TRUE;1.3;10;1.5;30;40;ExpertKnowledgeRRD;1;2;Uniform;0.1;1.2;1.3;1.4;0.01;0.02;0.03;1.1;1.2;klei;1.0;1.1;1.2;2.0;2.1;0.5;0.6;0.1;0.2;0.6;1.6;0.2;0.3;2.0;0.2;0.5;0.9;3.5;0.01;OptimizedSlopeAndShoulderAdaption;3.0;6.0;0.5;TRUE;1.8;TRUE;1.9;TRUE;2.9;TRUE;2.8;TRUE;2.7;TRUE;0.6;TRUE;2.6;TRUE;1.1;1.2;1.3;NoZones;0.5;1.6;1.0;0.1;TRUE;1.1;FALSE;0.11;Standard;10.1;1.2;1.3;1.4;1.5"); writer.WriteLine( "25-2-2-A-1-A;25-2-2-A-1-A;106;66586;424173;2;25-2-2-A-1-A;-0.25;-0.25;0.8727;-0.25;-0.25;1;1;klei;klei2;1;2;3;12;FALSE;1.3;10;1.5;30;40;ExpertKnowledgeRRD;1;2;Uniform;0.1;1.2;1.3;1.4;0.01;0.02;0.03;1.1;1.2;klei;1.0;1.1;1.2;2.0;2.1;0.5;0.6;0.1;0.2;0.6;1.6;0.2;0.3;2.0;0.2;0.5;0.9;3.5;0.2;SlopeAdaptionBeforeShoulderAdaption;4.5;6.5;0.25;FALSE;0.8;FALSE;0.9;FALSE;1.9;FALSE;1.8;FALSE;1.7;FALSE;0.7;FALSE;1.6;FALSE;1.4;1.5;1.6;ForbiddenZone;0.9;2.1; 1.1;0.11;FALSE; 1.0;TRUE;0.1;SemiTimeDependent;55.5;2.2;2.3;2.4;2.5"); } private static void CreateScenariosFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "location_id;location_scenario_id;water_height;water_height_low;dike_table_height;water_height_decimerings_hoogte;max_waterheight;safety_factor_piping;safety_factor_stability_inner_slope;safety_factor_stability_outer_slope;probability_of_failure_stability_innerslope;probability_of_failure_stability_outerslope;probability_of_failure_piping;uplift_criterion_piping;uplift_criterion_stability"); writer.WriteLine( "D1;1;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;63.310;0.000;1.3;0.000"); writer.WriteLine( "D2;1;0.000;1.680;22.110;2.000;1.220;32.600;1.000;1.400;32.730;3.310;1.000;1.3;0.000"); } private static void CreateScenariosFileWithOffsetData(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "location_id;location_scenario_id;water_height;water_height_low;dike_table_height;water_height_decimerings_hoogte;max_waterheight;safety_factor_piping;safety_factor_stability_inner_slope;safety_factor_stability_outer_slope;probability_of_failure_stability_innerslope;probability_of_failure_stability_outerslope;probability_of_failure_piping;uplift_criterion_piping;uplift_criterion_stability;PLLineOffsetBelowDikeTopAtRiver;PLLineOffsetBelowDikeTopAtPolder;PLLineOffsetBelowShoulderBaseInside;PLLineOffsetBelowDikeToeAtPolder;UsePLLineOffsetBelowDikeCrestMiddle;PLLineOffsetBelowDikeCrestMiddle;UsePLLineOffsetFactorBelowShoulderCrest;PLLineOffsetFactorBelowShoulderCrest;head_pl3;head_pl4"); writer.WriteLine( "D1;1;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;63.310;0.000;1.3;0.000;1.1;2.2;3.3;4.4;TRUE;5.5;FALSE;6.6;7.7;8.8"); writer.WriteLine( "D2;1;0.000;1.680;22.110;2.000;1.220;32.600;1.000;1.400;32.730;3.310;1.000;1.3;0.000;0.1;0.2;0.3;0.4;FALSE;0.5;TRUE;0.6;0.7;0.8"); } private static void CreateScenariosWithHeadPl3AndHeadPl4File(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("location_id;location_scenario_id;head_pl3;head_pl4"); writer.WriteLine("D1;1;0.001;0.002"); writer.WriteLine("D2;1;0.003;0.004"); } private static void CreateScenariosWithHeadPl3AndHeadPl4OldFormatFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("location_id;location_scenario_id;HeadPl3;HeadPl4"); writer.WriteLine("D1;1;0.011;0.012"); writer.WriteLine("D2;1;0.013;0.014"); } private static void CreateScenariosWithPolderLevelFile(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("location_id;location_scenario_id;polderlevel;"); writer.WriteLine("D1;1;0.001;"); writer.WriteLine("D2;1;0.003;"); } private static void CreateScenariosWithHeadPL2File(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine("location_id;location_scenario_id;head_pl2;"); writer.WriteLine("D1;1;0.001;"); writer.WriteLine("D2;1;0.003;"); } private void CreateScenariosFileWithIllegalHeader(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "location_id;water_height;water_height_low;dike_table_height;water_height_decimerings_hoogte;max_waterheight;safety_factor_piping;safety_factor_stability_inner_slope;safety_factor_stability_outer_slope;probability_of_failure_stability_innerslope;probability_of_failure_stability_outerslope;probability_of_failure_piping;uplift_criterion_piping;uplift_criterion_stability"); writer.WriteLine( "D1;1;0.000;0.680;21.110;0.000;1.120;31.600;0.000;1.300;31.730;63.310;0.000;1.3;0.000"); writer.WriteLine( "D2;1;0.000;1.680;22.110;2.000;1.220;32.600;1.000;1.400;32.730;3.310;1.000;1.3;0.000"); } private void CreateScenariosFileWithIllegalValues(string filePath) { using StreamWriter writer = File.CreateText(filePath); writer.WriteLine( "location_id;location_scenario_id;water_height;water_height_low;dike_table_height;water_height_decimerings_hoogte;max_waterheight;safety_factor_piping;safety_factor_stability_inner_slope;safety_factor_stability_outer_slope;probability_of_failure_stability_innerslope;probability_of_failure_stability_outerslope;probability_of_failure_piping;uplift_criterion_piping;uplift_criterion_stability"); writer.WriteLine( "D1;1;0.000;0.680;21.110;0.000;1.120;aa;0.000;1.300;31.730;63.310;0.000;1.3;0.000"); writer.WriteLine( "D2;1;0.000;1.680;dd;22.110;1.220;32.600;1.000;1.400;32.730;3.310;1.000;1.3;0.000"); } private static void CheckCharacteristicPoints(IList characteristicPointsRecords) { Assert.AreEqual("D1", characteristicPointsRecords[0].SurfaceLineId); Assert.AreEqual(1, characteristicPointsRecords[0].Volgnummer); Assert.AreEqual(117.94, characteristicPointsRecords[0].Points[0].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[0].Y); Assert.AreEqual(0.12, characteristicPointsRecords[0].Points[0].Z); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[1].X); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[1].Y); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[1].Z); Assert.AreEqual(73.99, characteristicPointsRecords[0].Points[2].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[2].Y); Assert.AreEqual(-1.0, characteristicPointsRecords[0].Points[2].Z); Assert.AreEqual(72.55, characteristicPointsRecords[0].Points[3].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[3].Y); Assert.AreEqual(-1.46, characteristicPointsRecords[0].Points[3].Z); Assert.AreEqual(67.9, characteristicPointsRecords[0].Points[4].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[4].Y); Assert.AreEqual(1.07, characteristicPointsRecords[0].Points[4].Z); Assert.AreEqual(63.31, characteristicPointsRecords[0].Points[5].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[5].Y); Assert.AreEqual(1.36, characteristicPointsRecords[0].Points[5].Z); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[6].X); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[6].Y); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[6].Z); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[7].X); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[7].Y); Assert.AreEqual(-1, characteristicPointsRecords[0].Points[7].Z); Assert.AreEqual(55.17, characteristicPointsRecords[0].Points[8].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[8].Y); Assert.AreEqual(4.46, characteristicPointsRecords[0].Points[8].Z); Assert.AreEqual(54.25, characteristicPointsRecords[0].Points[9].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[9].Y); Assert.AreEqual(4.69, characteristicPointsRecords[0].Points[9].Z); Assert.AreEqual(51.75, characteristicPointsRecords[0].Points[10].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[10].Y); Assert.AreEqual(4.662, characteristicPointsRecords[0].Points[10].Z); Assert.AreEqual(50.11, characteristicPointsRecords[0].Points[11].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[11].Y); Assert.AreEqual(4.46, characteristicPointsRecords[0].Points[11].Z); Assert.AreEqual(40.48, characteristicPointsRecords[0].Points[12].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[12].Y); Assert.AreEqual(1.94, characteristicPointsRecords[0].Points[12].Z); Assert.AreEqual(32.21, characteristicPointsRecords[0].Points[13].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[13].Y); Assert.AreEqual(1.67, characteristicPointsRecords[0].Points[13].Z); Assert.AreEqual(31.6, characteristicPointsRecords[0].Points[14].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[14].Y); Assert.AreEqual(1.3, characteristicPointsRecords[0].Points[14].Z); Assert.AreEqual(0, characteristicPointsRecords[0].Points[15].X); Assert.AreEqual(0, characteristicPointsRecords[0].Points[15].Y); Assert.AreEqual(0.68, characteristicPointsRecords[0].Points[15].Z); } private static void CheckSurfaceLine(IList surfaceLineRecords) { Assert.AreEqual("D1", surfaceLineRecords[0].SurfaceLineId); Assert.AreEqual(0.0, surfaceLineRecords[0].Xcoors[0]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[0]); Assert.AreEqual(0.680, surfaceLineRecords[0].Zcoors[0]); Assert.AreEqual(21.110, surfaceLineRecords[0].Xcoors[1]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[1]); Assert.AreEqual(1.120, surfaceLineRecords[0].Zcoors[1]); Assert.AreEqual(31.600, surfaceLineRecords[0].Xcoors[2]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[2]); Assert.AreEqual(1.300, surfaceLineRecords[0].Zcoors[2]); Assert.AreEqual(52.630, surfaceLineRecords[0].Xcoors[10]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[10]); Assert.AreEqual(4.770, surfaceLineRecords[0].Zcoors[10]); Assert.AreEqual(72.370, surfaceLineRecords[0].Xcoors[22]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[22]); Assert.AreEqual(-1.060, surfaceLineRecords[0].Zcoors[22]); Assert.AreEqual(86.660, surfaceLineRecords[0].Xcoors[30]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[30]); Assert.AreEqual(0.270, surfaceLineRecords[0].Zcoors[30]); Assert.AreEqual(117.940, surfaceLineRecords[0].Xcoors[32]); Assert.AreEqual(0.0, surfaceLineRecords[0].Ycoors[32]); Assert.AreEqual(0.120, surfaceLineRecords[0].Zcoors[32]); } }