Index: DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs =================================================================== diff -u -r875 -r2121 --- DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs (.../branches/CalcualtionIncluded/src/Dam/Tests/LoadCompatiblityTest.cs) (revision 875) +++ DamClients/DamUI/trunk/src/Dam/Tests/LoadCompatiblityTest.cs (.../trunk/src/Dam/Tests/LoadCompatiblityTest.cs) (revision 2121) @@ -1,11 +1,32 @@ -using System; +// Copyright (C) Stichting Deltares 2018. 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.IO; using System.Linq; using Deltares.Dam.Data; using Deltares.Dam.TestHelper; using Deltares.Geometry; -using Deltares.Geotechnics; using Deltares.Geotechnics.GeotechnicalGeometry; using Deltares.Geotechnics.Soils; using Deltares.Geotechnics.SurfaceLines; @@ -177,8 +198,8 @@ /// /// Compares the soil profiles. /// - /// The expected location. - /// The actual location. + /// The expected soilprofile1D. + /// The actual soilprofile1D. void CompareSoilProfiles(SoilProfile1D expectedSoilProfile1D, SoilProfile1D actualSoilProfile1D) { int expectedLayerCount = expectedSoilProfile1D.Layers.Count; @@ -196,8 +217,6 @@ [Category("Integration")] public void CanLoadVersion_1_3_3_1() { - //const string projectFilenameDelfland = @"..\..\..\data\Dam\Versions\V 1.3.3.1\Delfland\Traject1_metDSM.damx"; - //const string projectFilenameHd = @"..\..\..\data\Dam\Versions\V 1.3.3.1\HD\Oude Tonge GO.damx"; const string projectFilenameHhnk = @"..\..\..\data\Dam\Versions\V 1.3.3.1\HHNK\TPL_Hempolder.damx"; // HHNK (Hollands Noorderkwartier) @@ -312,12 +331,10 @@ [Category("Integration")] public void CanLoadVersion_1_5_2_1() { - //const string projectFilenameDelfland = @"..\..\..\data\Dam\Versions\V 1.5.2.1\Delfland\Traject1_metDSM.damx"; - //const string projectFilenameHd = @"..\..\..\data\Dam\Versions\V 1.5.2.1\HD\Oude Tonge GO.damx"; - const string projectFilenameHhnk = @"..\..\..\data\Dam\Versions\V 1.5.2.1\HHNK\TPL_Hempolder.damx"; + const string fullProjectFilename = @"..\..\..\data\Dam\Versions\V 1.5.2.1\HHNK\TPL_Hempolder.damx"; // HHNK (Hollands Noorderkwartier) - using (var projectData = ProjectLoader.LoadProjectData(projectFilenameHhnk)) + using (var projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) { // Check data using (Location expectedLocation = CreateHhnkTplHempolder100()) @@ -339,29 +356,28 @@ [Test] [Category("Integration")] - public void CanLoadVersion_14_1_1_14() + [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] + // [TestCase(@"HD\Oude Tonge GO.damx", @"HD\Oude Tonge GO0.soilmaterials.mdb", "GO_16_17_9")] + // [TestCase(@"Delfland\Traject1_metDSM.damx", @"Traject1_metDSM0.soilmaterials.mdb", "VDP1")] + // For above cases to run we have to create funcitons CreateHdOudeTongeGO_16_17_9() and CreateDelflandTraject1_metDSM0VDP1() + public void CanLoadVersion_14_1_1_14(string projectFilename, string expectedSoilbaseName, string locationName) { - //const string projectFilenameDelfland = @"..\..\..\data\Dam\Versions\V 14.1.1.14\Delfland\Traject1_metDSM.damx"; - //const string projectFilenameHd = @"..\..\..\data\Dam\Versions\V 14.1.1.14\HD\Oude Tonge GO.damx"; - const string projectFilenameHhnk = @"..\..\..\data\Dam\Versions\V 14.1.1.14\HHNK\TPL_Hempolder.damx"; + const string dataFolder = @"..\..\..\data\Dam\Versions\V 14.1.1.14\"; + string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - // HHNK (Hollands Noorderkwartier) - using (var projectData = ProjectLoader.LoadProjectData(projectFilenameHhnk)) + using (var projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) { // Check data using (Location expectedLocation = CreateHhnkTplHempolder100()) { - expectedLocation.SoildatabaseName = @"..\..\..\data\Dam\Versions\V 14.1.1.14\HHNK\TPL_Hempolder0.soilmaterials.mdb"; - Location actualLocation = projectData.Locations.Single(s => s.Name == "TPL_Hempolder_0100"); + expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); + Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); CompareSegments(expectedLocation, actualLocation); var result = compare.Compare(expectedLocation, actualLocation); Assert.AreEqual(0, result.Differences.Count, result.DifferencesString); CheckHempolderSurfaceline(actualLocation); - // TODO Implement for Delfland - - // TODO: Implement for HD (Hollandse Delta) } } } @@ -499,6 +515,62 @@ } } + [Test] + [Category("Integration")] + [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] + //[TestCase(@"HD\Oude Tonge GO.damx", @"HD\Oude Tonge GO0.soilmaterials.mdb", "GO_16_17_9")] + //[TestCase(@"Delfland\Traject1_metDSM.damx", @"Traject1_metDSM0.soilmaterials.mdb", "VDP1")] + // For above cases to run we have to create funcitons CreateHdOudeTongeGO_16_17_9() and CreateDelflandTraject1_metDSM0VDP1() + public void CanLoadVersion_15_1_1_3(string projectFilename, string expectedSoilbaseName, string locationName) + { + const string dataFolder = @"..\..\..\data\Dam\Versions\V 14.1.1.14\"; + string fullProjectFilename = Path.Combine(dataFolder, projectFilename); + + using (var projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) + { + // Check data + using (Location expectedLocation = CreateHhnkTplHempolder100()) + { + expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); + Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); + CompareSegments(expectedLocation, actualLocation); + var result = compare.Compare(expectedLocation, actualLocation); + Assert.AreEqual(0, result.Differences.Count, result.DifferencesString); + + CheckHempolderSurfaceline(actualLocation); + + } + } + } + + [Test] + [Category("Integration")] + [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] + //[TestCase(@"HD\Oude Tonge GO.damx", @"HD\Oude Tonge GO0.soilmaterials.mdb", "GO_16_17_9")] + //[TestCase(@"Delfland\Traject1_metDSM.damx", @"Traject1_metDSM0.soilmaterials.mdb", "VDP1")] + // For above cases to run we have to create funcitons CreateHdOudeTongeGO_16_17_9() and CreateDelflandTraject1_metDSM0VDP1() + public void CanLoadVersion_18_1_3(string projectFilename, string expectedSoilbaseName, string locationName) + { + const string dataFolder = @"..\..\..\data\Dam\Versions\V 18.1.3\"; + string fullProjectFilename = Path.Combine(dataFolder, projectFilename); + + using (var projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) + { + // Check data + using (Location expectedLocation = CreateHhnkTplHempolder100()) + { + expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); + Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); + CompareSegments(expectedLocation, actualLocation); + var result = compare.Compare(expectedLocation, actualLocation); + Assert.AreEqual(0, result.Differences.Count, result.DifferencesString); + + CheckHempolderSurfaceline(actualLocation); + + } + } + } + /// /// Test if the project can be saved and loaded with the current version of the source /// - Load old project