Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs
===================================================================
diff -u -r6008 -r6068
--- DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6008)
+++ DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/DamEngineIo/FillXmlInputFromDamUiTests.cs (.../FillXmlInputFromDamUiTests.cs) (revision 6068)
@@ -43,6 +43,7 @@
using SensorLocation = Deltares.Dam.Data.Sensors.SensorLocation;
using Soil = Deltares.Geotechnics.Soils.Soil;
using SoilProfile1D = Deltares.Geotechnics.Soils.SoilProfile1D;
+using SoilProfile2D = Deltares.DamEngine.Io.XmlInput.SoilProfile2D;
using TimeSerie = Deltares.Dam.Data.TimeSerie;
namespace Deltares.Dam.Tests.DamEngineIo
@@ -61,17 +62,20 @@
DamProjectData expectedDamProjectData = CreateExampleDamProjectData();
// Write input file
- Input input = FillXmlInputFromDamUi.CreateInput(expectedDamProjectData);
- DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input);
-
+ Input expectedInput = FillXmlInputFromDamUi.CreateInput(expectedDamProjectData);
+ DamXmlSerialization.SaveInputAsXmlFile(inputFilename, expectedInput);
+
// Init static that is to be loaded with not expected value
DamProjectCalculationSpecification.SelectedAnalysisType = notExpectedAnalysisType;
// Load input file
- input = DamXmlSerialization.LoadInputFromXmlFile(inputFilename);
- DamProjectData actualDamProjectData = FillDamUiFromXmlInput.CreateDamProjectData(input);
+ Input actualInput = DamXmlSerialization.LoadInputFromXmlFile(inputFilename);
+ DamProjectData actualDamProjectData = FillDamUiFromXmlInput.CreateDamProjectData(actualInput);
CompareSoilLists(actualDamProjectData.WaterBoard.Dikes[0].SoilList, expectedDamProjectData.WaterBoard.Dikes[0].SoilList);
CompareDamProjectData(actualDamProjectData, expectedDamProjectData);
+ // The soil profiles 2D are not present in the expectedDamProjectData because they are created when calling
+ // FillXmlInputFromDamUi.CreateInput. That's why they must be checked separately from the Input object.
+ CompareSoilProfiles2D(actualInput.SoilProfiles2D, expectedInput.SoilProfiles2D);
}
[Test]
@@ -658,7 +662,7 @@
[Test]
public void RaiseExceptionWhenWaterBoardIsNotDefined()
{
- // Given DataSet with undefine waterboard
+ // Given DataSet with undefined waterboard
var damProjectData = new DamProjectData();
damProjectData.WaterBoard = null;
@@ -668,7 +672,7 @@
}
/// Compares the soil lists.
- /// The object comparer does not handle NaN's correctly, therefore this mehthod is created.
+ /// The object comparer does not handle NaN's correctly, therefore this method is created.
/// The actual soil list.
/// The expected soil list.
private void CompareSoilLists(SoilList actualSoilList, SoilList expectedSoilList)
@@ -697,6 +701,25 @@
Assert.That(actualSoil.RatioCuPc, Is.EqualTo(expectedSoil.RatioCuPc), string.Format(errorMessage, "RatioCuPc"));
}
}
+
+ private static void CompareSoilProfiles2D(SoilProfile2D[] actual, SoilProfile2D[] expected)
+ {
+ var compare = new CompareLogic
+ {
+ Config =
+ {
+ MaxDifferences = 10
+ }
+ };
+ ComparisonResult result = compare.Compare(expected, actual);
+ Assert.Multiple(() =>
+ {
+ Assert.That(result.Differences, Is.Empty,
+ "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));
+ });
+ }
private void CompareDamProjectData(DamProjectData actual, DamProjectData expected)
{
@@ -721,7 +744,7 @@
}
};
ComparisonResult result = compare.Compare(expected, actual);
- Assert.That(result.Differences.Count, Is.EqualTo(0),
+ Assert.That(result.Differences, Is.Empty,
"Differences found read/write Input object:" + result.DifferencesString);
}
@@ -1263,7 +1286,7 @@
private static void FillSegments(DamProjectData damProjectData)
{
- var segmentCount = 2;
+ const int segmentCount = 2;
Dike dike = damProjectData.WaterBoard.Dikes[0];
for (var i = 0; i < segmentCount; i++)
{
@@ -1275,9 +1298,7 @@
if (i == 0)
{
soilProfileProbability.SegmentFailureMechanismType = FailureMechanismSystemType.StabilityInside;
- soilProfileProbability.SoilGeometry2DName = $"Profile2D {i + 1}";
- //TODO: soilProfileProbability.SoilProfile2D = FillDamUiFromXmlInput.FindSoilProfile2DByName(damProjectData.WaterBoard.Dikes[0].,
- // soilProfileProbability.SoilGeometry2DName);
+ soilProfileProbability.SoilGeometry2DName = $"Profile2D 1"; // Soil profile with inner loop
}
else
{
Index: DamClients/DamUI/trunk/src/Dam/Deltares.Dam.Tests/TestData/FillXMLInputFromDamUI/Profile2D 1.stix
===================================================================
diff -u -r4286 -r6068
Binary files differ