Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/LoadCompatiblityTest.cs =================================================================== diff -u -r4638 -r6028 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/LoadCompatiblityTest.cs (.../LoadCompatiblityTest.cs) (revision 4638) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/LoadCompatiblityTest.cs (.../LoadCompatibilityTest.cs) (revision 6028) @@ -19,623 +19,100 @@ // 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.Data.DataPlugins.Configuration; using Deltares.Dam.TestHelper; -using Deltares.Geotechnics.Soils; -using Deltares.Geotechnics.SurfaceLines; using KellermanSoftware.CompareNetObjects; using NUnit.Framework; -namespace Deltares.Dam.Tests +namespace Deltares.Dam.Tests; + +[TestFixture] +public class LoadCompatibilityTest { - /// - /// In this test the XML serialization is tested. - /// - Can old projects be loaded; A test should be included for each release of the software - /// - Can the project be saved and loaded with the current version of the source - /// - [TestFixture] - public class LoadCompatiblityTest - { - CompareLogic compare; + private string tmpTestFolder; - /// - /// Code that is run before each test - /// - [SetUp] - public void Initialize() + [SetUp] + public void FixtureSetup() + { + tmpTestFolder = Path.Combine(Directory.GetCurrentDirectory(), "LoadCompatibilityTests"); + if (Directory.Exists(tmpTestFolder)) { - compare = new CompareLogic - { - Config = - { - MaxDifferences = 100, - CompareChildren = false, - DoublePrecision = 0.000001, - MembersToIgnore = new List - { - "SurfaceLineId", - "SheetPilePoint", - "SheetPilePointX", - "SheetPilePointY", - "SheetPilePointZ", - "LocalXZSheetPilePoint", - "SurfaceLine", - "LocalXZSurfaceLine", - "SoilLayer1D", - "SoildatabaseName", - "SoilList", - "MapForSoilGeometries2D" - } - } - }; + Directory.Delete(tmpTestFolder, true); } + Directory.CreateDirectory(tmpTestFolder); + } - [Test] - [Category("Integration")] - public void CanLoadVersion_1_3_3_1() + [TearDown] + public void FixtureTearDown() + { + if (Directory.Exists(tmpTestFolder)) { - const string projectFilenameHhnk = @"..\..\..\..\..\data\Dam\V 1.3.3.1\HHNK\TPL_Hempolder.damx"; - using (DamProjectData projectData = ProjectLoader.LoadProjectData(projectFilenameHhnk)) - { - Assert.That(projectData.DamProjectType, Is.EqualTo(DamProjectType.AssessOld)); - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } + Directory.Delete(tmpTestFolder, true); } + } + + [Test] + public void CanSaveAndLoadTutorialDesignStability() + { + const string definitionFilename = @"..\..\..\..\..\data\Tutorials\DAMDesign\Stability\DAM Tutorial Design.defx"; + string projectFilename = Path.Combine(tmpTestFolder, "TestTutorialDesignStability.damx"); - /// - /// Determines whether version_1_5_1_7 can be loaded. - /// - [Test] - [Category("Integration")] - public void CanLoadVersion_1_5_1_7_ScenariosPLLineParameters() + // Create damx from defx + DataSourceContainer dataSourceContainer = DataSourceContainer.Deserialize(definitionFilename); + string damProjectFolder = Path.GetDirectoryName(definitionFilename); + var damProject = new DamProject(); + damProject.ProjectFileName = projectFilename; + damProject.DamProjectData.DamProjectType = DamProjectType.Design; + damProject.DamProjectData.DamDataSourceFileName = definitionFilename; + if (dataSourceContainer.MapSoilProfile2D != null) { - const string projectFilenameTutorialDesign = @"..\..\..\..\..\data\Dam\V 1.5.1.7\Tutorial Design\DAM Tutorial Design (Old 1.5.1.7).damx"; - using (DamProjectData projectData = ProjectLoader.LoadProjectData(projectFilenameTutorialDesign)) - { - foreach (Location location in projectData.Locations) - { - // surfaceline2 present with characteristic points ? - Assert.That(location.SurfaceLine2, Is.Not.Null); - Assert.That(location.SurfaceLine2.Name, Is.EqualTo(location.Name)); - Assert.That(location.SurfaceLine2.CharacteristicPoints.GeometryMustContainPoint, Is.EqualTo(true)); - Assert.That(location.SurfaceLine2.HasDike(), Is.EqualTo(true)); - } - } + damProject.AssignGeometry2DMapnameIfNotAssigned(Path.Combine(damProjectFolder, dataSourceContainer.MapSoilProfile2D)); } - - [Test] - [Category("Integration")] - public void CanLoadVersion_1_5_2_1() + var dikeRings = new List { - const string fullProjectFilename = @"..\..\..\..\..\data\Dam\V 1.5.2.1\HHNK\TPL_Hempolder.damx"; - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - Assert.That(projectData.DamProjectType, Is.EqualTo(DamProjectType.AssessOld)); - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } - } - - [Test] - [Category("Integration")] - [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] - public void CanLoadVersion_14_1_1_14(string projectFilename, string expectedSoilbaseName, string locationName) + "Dike from CSV" + }; + damProject.Import(damProjectFolder, dataSourceContainer, dikeRings, DamProjectType.Design, null); + + // Save in current XML format + DamProject.SaveData(projectFilename, damProject.DamProjectData); + // Load from current XML format + DamProjectData currentProjectData = ProjectLoader.LoadProjectData(projectFilename); + + // Compare segments + Assert.That(currentProjectData.WaterBoard.Segments, Has.Count.EqualTo(23)); + Segment segmentDWP1 = currentProjectData.WaterBoard.Segments.Single(s => s.Name == "DWP_1"); + Assert.That(segmentDWP1.SoilProfileProbabilities, Has.Count.EqualTo(1)); + Assert.That(segmentDWP1.SoilProfileProbabilities[0].SoilGeometryName, Is.EqualTo("DWP_1.stix")); + Segment segmentDWP11 = currentProjectData.WaterBoard.Segments.Single(s => s.Name == "DWP_11"); + Assert.That(segmentDWP11.SoilProfileProbabilities, Has.Count.EqualTo(3)); + Assert.Multiple(() => { - const string dataFolder = @"..\..\..\..\..\data\Dam\V 14.1.1.14\"; - string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - if (projectData.DamProjectType == DamProjectType.AssessOld) - { - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } - else - { - // Check data - using (Location expectedLocation = CreateHhnkTplHempolder100()) - { - expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); - Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); - CompareSegments(expectedLocation, actualLocation); - ComparisonResult result = compare.Compare(expectedLocation, actualLocation); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - CheckHempolderSurfaceline(actualLocation); - } - } - } - } - - [Test] - [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] - [TestCase(@"HHNKRegionalDesign\HHNK HemPolder Regional Design.damx", @"HHNKRegionalDesign\HHNK HemPolder Regional Design0.soilmaterials.mdb", "TPL_Hempolder_0100")] - public void CanLoadVersion_15_1_1_3(string projectFilename, string expectedSoilbaseName, string locationName) + Assert.That(segmentDWP11.SoilProfileProbabilities[0].SoilGeometryName, Is.EqualTo("DWP_11_1.stix")); + Assert.That(segmentDWP11.SoilProfileProbabilities[1].SoilGeometryName, Is.EqualTo("DWP_11_2.stix")); + Assert.That(segmentDWP11.SoilProfileProbabilities[2].SoilGeometryName, Is.EqualTo("DWP_11_3.stix")); + }); + + // Compare locations + Assert.That(currentProjectData.Locations, Has.Count.EqualTo(23)); + Location locationDWP1 = currentProjectData.Locations.Single(s => s.Name == "DWP_1"); + Assert.Multiple(() => { - const string dataFolder = @"..\..\..\..\..\data\Dam\V 15.1.1.3\"; - string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - if (projectData.DamProjectType == DamProjectType.AssessOld) - { - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } - else - { - // Check data - using (Location expectedLocation = CreateHhnkTplHempolder100()) - { - expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); - Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); - CompareSegments(expectedLocation, actualLocation); - ComparisonResult result = compare.Compare(expectedLocation, actualLocation); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - CheckHempolderSurfaceline(actualLocation); - } - } - } - } - - /// Determines whether a project of version 18.1.3 is loaded correctly. - /// This test fails, because the following properties were moved from Location to location.Scenarios[] - /// - PolderLevel - /// - HeadPl2 - /// - HeadPl3 - /// - HeadPl4 - /// And this is not handled correctly - /// - /// The project filename. - /// Expected name of the soilbase. - /// Name of the location. - [Test] - [TestCase(@"HHNK\TPL_Hempolder.damx", @"HHNK\TPL_Hempolder0.soilmaterials.mdb", "TPL_Hempolder_0100")] - [TestCase(@"HHNKRegionalDesign\HHNK HemPolder Regional Design.damx", @"HHNKRegionalDesign\HHNK HemPolder Regional Design0.soilmaterials.mdb", "TPL_Hempolder_0100")] - public void CanLoadVersion_18_1_3(string projectFilename, string expectedSoilbaseName, string locationName) + Assert.That(locationDWP1.SegmentId, Is.EqualTo("DWP_1")); + Assert.That(locationDWP1.Scenarios.Count, Is.EqualTo(1)); + Assert.That(locationDWP1.SurfaceLineId, Is.EqualTo("DWP_1")); + }); + Location locationDWP10 = currentProjectData.Locations.Single(s => s.Name == "DWP_10"); + Assert.Multiple(() => { - const string dataFolder = @"..\..\..\..\..\data\Dam\V 18.1.3\"; - string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - if (projectData.DamProjectType == DamProjectType.AssessOld) - { - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } - else - { - using (Location expectedLocation = CreateHhnkTplHempolder100()) - { - expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); - Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); - CompareSegments(expectedLocation, actualLocation); - ComparisonResult result = compare.Compare(expectedLocation, actualLocation); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - result = compare.Compare(expectedLocation.Scenarios[0], actualLocation.Scenarios[0]); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - CheckHempolderSurfaceline(actualLocation); - } - } - // Check data - } - } - - /// Determines whether a project of version 19.1.1 is loaded correctly. - /// This test fails, because the following properties were moved from Location to location.Scenarios[] - /// - PolderLevel - /// - HeadPl2 - /// And this is not handled correctly - /// - /// The project filename. - /// Expected name of the soilbase. - /// Name of the location. - [Test] - [Category("Integration")] - [TestCase(@"HHNKRegionalDesign\HHNK HemPolder Regional Design.damx", @"HHNKRegionalDesign\HHNK HemPolder Regional Design0.soilmaterials.mdb", "TPL_Hempolder_0100")] - public void CanLoadVersion_19_1_1(string projectFilename, string expectedSoilbaseName, string locationName) - { - const string dataFolder = @"..\..\..\..\..\data\Dam\V 19.1.1\"; - string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - if (projectData.DamProjectType == DamProjectType.AssessOld) - { - Assert.That(projectData.Locations.Count, Is.EqualTo(0)); - } - else - { - using (Location expectedLocation = CreateHhnkTplHempolder100()) - { - expectedLocation.SoildatabaseName = Path.Combine(dataFolder, expectedSoilbaseName); - Location actualLocation = projectData.Locations.Single(s => s.Name == locationName); - CompareSegments(expectedLocation, actualLocation); - ComparisonResult result = compare.Compare(expectedLocation, actualLocation); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - result = compare.Compare(expectedLocation.Scenarios[0], actualLocation.Scenarios[0]); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - - CheckHempolderSurfaceline(actualLocation); - } - } - // Check data - } - } - - [Test] - [Category("Integration")] - [TestCase(@"..\..\..\..\..\data\Dam\V 15.1.1.3\HHNKRegionalDesign\", @"HHNK HemPolder Regional Design - Calculated.damx")] - [TestCase(@"..\..\..\..\..\data\Dam\V 18.1.3\HHNKRegionalDesign\", @"HHNK HemPolder Regional Design - Calculated.damx")] - [TestCase(@"..\..\..\..\..\data\Dam\V 15.1.1.3\TutorialDesign\", @"DAM Tutorial Design - Calculated.damx")] - [TestCase(@"..\..\..\..\..\data\Dam\V 18.1.3\TutorialDesign\", @"DAM Tutorial Design - Calculated.damx")] - public void GivenOldProjectFileWithCalculationResultsWhenLoadingThisFileThenResultsAreNotLoaded( - string dataFolder, string projectFilename) - { - string fullProjectFilename = Path.Combine(dataFolder, projectFilename); - using (DamProjectData projectData = ProjectLoader.LoadProjectData(fullProjectFilename)) - { - Assert.That(projectData.DesignCalculations.Count, Is.EqualTo(0)); - } - } - - /// - /// Test if the project can be saved and loaded with the current version of the source - /// - Load old project - /// - save this project - /// - load this project - /// - compare for a specific location if the data is correct - /// This test is based on the same data as in CanLoadVersion_15_1_1_3() - /// - [Test] - [Category("Work_In_Progress")] - [Ignore("project uses Bishop which is not yet supported for MacroStability kernel.")] - public void CanSaveAndLoadCurrentVersion() - { - const string projectFilenameHhnk = @"..\..\..\..\..\data\Dam\V 15.1.1.3\HHNKRegionalDesign\HHNK HemPolder Regional Design.damx"; - const string projectFilenameCurrentVersion = @".\TPL_HempolderCurrent.damx"; - - // HHNK (Hollands Noorderkwartier) - using (DamProjectData projectData = ProjectLoader.LoadProjectData(projectFilenameHhnk)) - { - // Save in current XML format - DamProject.SaveData(projectFilenameCurrentVersion, projectData); - - // Load from current XML format - using (DamProjectData currentProjectData = ProjectLoader.LoadProjectData(projectFilenameCurrentVersion)) - using (Location expectedLocation = CreateHhnkTplHempolder100()) // Check data - { - expectedLocation.SoildatabaseName = @".\TPL_HempolderCurrent0.soilmaterials.mdb"; - Location actualLocation = currentProjectData.Locations.Single(s => s.Name == "TPL_Hempolder_0100"); - ComparisonResult result = compare.Compare(expectedLocation, actualLocation); - Assert.That(result.Differences.Count, Is.EqualTo(0), result.DifferencesString); - } - } - } - - /// - /// Create expected location for "TPL_Hempolder_0100" - /// - /// - private Location CreateHhnkTplHempolder100() - { - var location = new Location - { - AreLocalXZObjectsCreated = true, - Name = "TPL_Hempolder_0100", - DikeRingId = "TPL_Hempolder", - Description = "", - XRd = 111232.178664511, - YRd = 507197.06382921, - SegmentId = "234", - XSoilGeometry2DOrigin = 0.0, // actual value - DikeEmbankmentMaterial = "HHNK1_Bfg", - ShoulderEmbankmentMaterial = "HHNK1_Bfl", - DampingFactorPL3 = 0.0, // actual value - DampingFactorPL4 = 0.0, // actual value - PenetrationLength = 0.0, // actual value - TrafficLoad = 5.0, - PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD, - StabilityShoulderGrowSlope = 0.333333333333333, - StabilityShoulderGrowDeltaX = 2.0, - StabilitySlopeAdaptionDeltaX = 2.0, - MinimalCircleDepth = 1.5, - DistanceToEntryPoint = 0.0, // actual value - StabilityZoneType = MStabZonesType.NoZones, - Segment = new Segment - { - Name = "234" - } - }; - location.Scenarios.Add(new Scenario - { - LocationScenarioID = "1", - RiverLevel = 0.98, - RiverLevelLow = 0.98, - DikeTableHeight = 2.31, - PolderLevel = -1.3, - HeadPl2 = -1.3, - HeadPl3 = -1.6, - HeadPl4 = null, - PlLineOffsetBelowDikeTopAtRiver = 0.5, // actual value - PlLineOffsetBelowDikeTopAtPolder = 1.5, // actual value - PlLineOffsetBelowShoulderBaseInside = 0.1, - PlLineOffsetBelowDikeToeAtPolder = 0.1, // actual value - - ModelFactors = new ModelFactors - { - UpliftCriterionPiping = 1.2, - UpliftCriterionStability = 1.2, - RequiredSafetyFactorStabilityInnerSlope = 1.16, - RequiredSafetyFactorStabilityOuterSlope = 1.0 - } - }); - - var soilProfile = new SoilProfile1D - { - Name = "Segment_234_1D1", - BottomLevel = -29 - }; - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_kade" - }, 30) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfo" - }, -1) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Ppp" - }, -1.5) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfg" - }, -4) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcs" - }, -5.5) - { - IsAquifer = true - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Bss" - }, -24) - { - IsAquifer = true - }); - location.Segment.AddSoilProfileProbability(soilProfile, 0.0, FailureMechanismSystemType.StabilityInside); - location.Segment.SoilProfileProbabilities[0].Probability = 69.3; - soilProfile = new SoilProfile1D - { - Name = "Segment_234_1D2", - BottomLevel = -29 - }; - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_kade" - }, 30) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfo" - }, -1) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Ppp" - }, -1.5) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfg" - }, -4) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcc" - }, -5.5) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcs" - }, -12.5) - { - IsAquifer = true - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Bss" - }, -24) - { - IsAquifer = true - }); - location.Segment.AddSoilProfileProbability(soilProfile, 0.0, FailureMechanismSystemType.StabilityInside); - location.Segment.SoilProfileProbabilities[1].Probability = 0.7; - soilProfile = new SoilProfile1D - { - Name = "Segment_234_1D3", - BottomLevel = -29 - }; - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_kade" - }, 30) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfo" - }, -1) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Ppp" - }, -1.5) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfg" - }, -4) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcs" - }, -7) - { - IsAquifer = true - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Bss" - }, -24) - { - IsAquifer = true - }); - location.Segment.AddSoilProfileProbability(soilProfile, 0.0, FailureMechanismSystemType.StabilityInside); - location.Segment.SoilProfileProbabilities[2].Probability = 29.7; - soilProfile = new SoilProfile1D - { - Name = "Segment_234_1D4", - BottomLevel = -29 - }; - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_kade" - }, 30) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfo" - }, -1) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Ppp" - }, -1.5) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tfg" - }, -4) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcc" - }, -7) - { - IsAquifer = false - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Tcs" - }, -14) - { - IsAquifer = true - }); - soilProfile.Layers.Add(new SoilLayer1D(new Soil - { - Name = "HHNK1_Bss" - }, -24) - { - IsAquifer = true - }); - location.Segment.AddSoilProfileProbability(soilProfile, 0.0, FailureMechanismSystemType.StabilityInside); - location.Segment.SoilProfileProbabilities[3].Probability = 0.3; - return location; - } - - /// - /// Compares the soil profiles. - /// - /// The expected soilprofile1D. - /// The actual soilprofile1D. - void CompareSoilProfiles(SoilProfile1D expectedSoilProfile1D, SoilProfile1D actualSoilProfile1D) - { - int expectedLayerCount = expectedSoilProfile1D.Layers.Count; - int actualLayerCount = expectedSoilProfile1D.Layers.Count; - Assert.That(actualLayerCount, Is.EqualTo(expectedLayerCount)); - - for (var layerIndex = 0; layerIndex < expectedLayerCount; layerIndex++) - { - Assert.That(actualSoilProfile1D.Layers[layerIndex].Soil.Name, Is.EqualTo(expectedSoilProfile1D.Layers[layerIndex].Soil.Name), String.Format("Non-matching name in layer {0}", layerIndex)); - Assert.That(actualSoilProfile1D.Layers[layerIndex].IsAquifer, Is.EqualTo(expectedSoilProfile1D.Layers[layerIndex].IsAquifer), String.Format("Non-matching isAquifer in layer {0}", layerIndex)); - } - } - - private static void CheckHempolderSurfaceline(Location actualLocation) - { - const double accuracy = 0.01; - // quick check for surfaceline2 conversion - Assert.That(actualLocation.SurfaceLine2, Is.Not.Null); - Assert.That(actualLocation.SurfaceLine2.Name, Is.EqualTo("TPL_Hempolder_0100")); - Assert.That(actualLocation.SurfaceLine2.CharacteristicPoints.GeometryMustContainPoint, Is.EqualTo(true)); - Assert.That(actualLocation.SurfaceLine2.HasDike(), Is.EqualTo(true)); - CharacteristicPoint dikeToeAtRiver = actualLocation.SurfaceLine2.CharacteristicPoints.FirstOrDefault(p => p.CharacteristicPointType == CharacteristicPointType.DikeToeAtRiver); - Assert.That(dikeToeAtRiver, Is.Not.Null); - Assert.That(dikeToeAtRiver.X, Is.EqualTo(111222.28).Within(accuracy)); - Assert.That(dikeToeAtRiver.Y, Is.EqualTo(507206.24).Within(accuracy)); - } - - /// - /// Compares the segments. - /// - /// The expected location. - /// The actual location. - private void CompareSegments(Location expectedLocation, Location actualLocation) - { - for (var soilProfile1DIndex = 0; - soilProfile1DIndex < expectedLocation.Segment.SoilProfileProbabilities.Count; - soilProfile1DIndex++) - { - CompareSoilProfiles(expectedLocation.Segment.SoilProfileProbabilities[soilProfile1DIndex].SoilProfile, - actualLocation.Segment.SoilProfileProbabilities[soilProfile1DIndex].SoilProfile); - } - } + Assert.That(locationDWP10.SegmentId, Is.EqualTo("DWP_10")); + Assert.That(locationDWP10.Scenarios.Count, Is.EqualTo(3)); + Assert.That(locationDWP10.SurfaceLineId, Is.EqualTo("DWP_10")); + }); } -} \ No newline at end of file +} +