Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs =================================================================== diff -u -r6262 -r6286 --- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6262) +++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6286) @@ -183,33 +183,38 @@ // When Input input = FillXmlInputFromDamUi.CreateInput(projectData); - // Then - // Note that the original test setup of DAMProject --> XML --> DAMProject does not - // work in this context, as there is NO field within DAMProject to contain the SoilProfile2D - // The only way to assert that the selected locations, segments and their profiles are present, - // is to verify the XMLInput objects that are generated by the CreateInput() call. - Assert.That(input.Locations.Select(loc => loc.Name), Is.EquivalentTo(selectedLocations)); - Assert.That(input.Segments.Select(segment => segment.Name), Is.EquivalentTo(new[] + Assert.Multiple(() => { - selectedSegmentOneName, - selectedSegmentTwoName - })); + // Then + // Note that the original test setup of DAMProject --> XML --> DAMProject does not + // work in this context, as there is NO field within DAMProject to contain the SoilProfile2D + // The only way to assert that the selected locations, segments and their profiles are present, + // is to verify the XMLInput objects that are generated by the CreateInput() call. + Assert.That(input.Locations.Select(loc => loc.Name), Is.EquivalentTo(selectedLocations)); + Assert.That(input.Segments.Select(segment => segment.Name), Is.EquivalentTo(new[] + { + selectedSegmentOneName, + selectedSegmentTwoName + })); + }); DamEngine.Io.XmlInput.Segment segmentWith1DProfile = input.Segments.Single(s => string.Equals(s.Name, selectedSegmentOneName)); Assert.That(segmentWith1DProfile.SoilGeometryProbability.All(prob => prob.SoilProfileType == ConversionHelper.ConvertToInputSoilProfileType(SoilProfileType.SoilProfile1D)), Is.True); DamEngine.Io.XmlInput.Segment segmentWith2DProfile = input.Segments.Single(s => string.Equals(s.Name, selectedSegmentTwoName)); - Assert.That(segmentWith2DProfile.SoilGeometryProbability.All(prob => prob.SoilProfileType == ConversionHelper.ConvertToInputSoilProfileType(SoilProfileType.SoilProfile2D)), Is.True); - - Assert.That(input.SoilProfiles1D.Select(profile => profile.Name), Is.EquivalentTo(new[] + Assert.Multiple(() => { - firstSoilProfile1DName, - secondSoilProfile1DName - })); - Assert.That(input.SoilProfiles2D.Select(profile => profile.Name), Is.EquivalentTo(new[] - { - profile2DName + ".stix" - })); + Assert.That(segmentWith2DProfile.SoilGeometryProbability.All(prob => prob.SoilProfileType == ConversionHelper.ConvertToInputSoilProfileType(SoilProfileType.SoilProfile2D)), Is.True); + + Assert.That(input.SoilProfiles1D.Select(profile => profile.Name), Is.EquivalentTo(new[] + { + firstSoilProfile1DName + })); + Assert.That(input.SoilProfiles2D.Select(profile => profile.Name), Is.EquivalentTo(new[] + { + profile2DName + ".stix" + })); + }); } [Test] @@ -715,7 +720,7 @@ Assert.Multiple(() => { Assert.That(result.Differences, Is.Empty, - "Differences found read/write Soil Profile 2D object:" + result.DifferencesString); + "Differences found read/write Soil Profile 2D object:" + result.DifferencesString); // Check that the soil profile 2D used in the DamProjectData contains an inner loop (with 4 points) Assert.That(actual[0].Layers2D[1].Surface.Innerloop, Has.Length.EqualTo(4)); }); @@ -1213,39 +1218,36 @@ private static void FillSoilProfiles1D(Dike dike) { dike.SoilProfiles = new List(); - const int profilesCount = 2; - for (var i = 0; i < profilesCount; i++) + var profile = new SoilProfile1D { - var profile = new SoilProfile1D + Name = "Profile1D 1", + BottomLevel = -21.12 + }; + const int layerCount = 3; + for (var j = 0; j < layerCount; j++) + { + var layer = new SoilLayer1D { - Name = "Profile1D " + (i + 1), - BottomLevel = -21.12 * (i + 1) + Id = "L" + j, + Soil = dike.SoilList.Soils[j], + TopLevel = 1 * -j }; - const int layerCount = 3; - for (var j = 0; j < layerCount; j++) + if (j < 2) { - var layer = new SoilLayer1D - { - Id = "L" + j, - Soil = dike.SoilList.Soils[j], - TopLevel = 1 * -j - }; - if (j < 2) - { - layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; - layer.IsAquifer = false; - } - else - { - layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; - layer.IsAquifer = true; - } - - profile.Layers.Add(layer); + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; + layer.IsAquifer = false; } + else + { + layer.WaterpressureInterpolationModel = WaterpressureInterpolationModel.Hydrostatic; + layer.IsAquifer = true; + } - dike.SoilProfiles.Add(profile); + profile.Layers.Add(layer); } + + dike.SoilProfiles.Add(profile); + } private static void FillSegments(DamProjectData damProjectData) @@ -1267,7 +1269,7 @@ else { soilProfileProbability.SegmentFailureMechanismType = FailureMechanismSystemType.Piping; - string soilProfile1DName = "Profile1D " + (i + 1); + string soilProfile1DName = "Profile1D 1"; soilProfileProbability.SoilProfile = FillDamUiFromXmlInput.FindSoilProfile1DByName(dike.SoilProfiles, soilProfile1DName); }