Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs =================================================================== diff -u -r800 -r801 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs (.../DamMacroStabilityKernelWrapperTests.cs) (revision 800) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/DamMacroStabilityKernelWrapperTests.cs (.../DamMacroStabilityKernelWrapperTests.cs) (revision 801) @@ -38,53 +38,46 @@ [TestFixture] public class DamMacroStabilityTests { -// [Test] -// public void TestFullCalculation() -// { -// const double diff = 0.01; -// -// // ToDo zant Fill input -// var damKernelInput = new DamKernelInput(); -// -// var kernelWrapper = new DamMacroStabilityKernelWrapper(); -// -// // Prepare the wrapper. Result is input for the calculation dll -// IKernelDataInput damStabilityInput; -// IKernelDataOutput kernelOutput; -// kernelWrapper.Prepare(damKernelInput, out damStabilityInput, out kernelOutput); -// -// // Validate the input -// List messages; -// kernelWrapper.Validate(damStabilityInput, kernelOutput, out messages); -// Assert.AreEqual(0, messages.Count); -// -// // Run the dll -// kernelWrapper.Execute(damStabilityInput, kernelOutput, out messages); -// DamMacroStabilityOutput damMacroStabilityOutput = (DamMacroStabilityOutput) kernelOutput; -// Assert.AreEqual(0, messages.Count); -// Assert.AreEqual(1.282, damMacroStabilityOutput.Zone1Results.SafetyFactor, diff); -// Assert.IsNull(damMacroStabilityOutput.Zone2Results); -// -// // Fill the design results -// DesignResult result; -// kernelWrapper.PostProcess(damKernelInput, damMacroStabilityOutput, "", out result); -// Assert.AreEqual(1.282, result.StabilityDesignResults.SafetyFactor, diff); -// } + private const string TestFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\KernelWrappers\DamMacroStability\TestData"; - [Test] - public void TestCreateDGeoStabilityInputFile() - { - const string testFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\KernelWrappers\DamMacroStability\TestData"; - var xmlFileName = Path.Combine(testFolder, "test.xml"); - var stiFileName = Path.Combine(testFolder, "test.sti"); - var geometryFileName = Path.Combine(testFolder, "DWP_1.sti"); - var soilDbName = Path.Combine(testFolder, "DAM Tutorial Design0.soilmaterials.mdb"); - var expectedStiFileName = Path.Combine(testFolder, "expectedTest.sti"); - if (File.Exists(stiFileName)) - { - File.Delete(stiFileName); - } + // [Test] + // public void TestFullCalculation() + // { + // const double diff = 0.01; + // + // // ToDo zant Fill input + // var damKernelInput = new DamKernelInput(); + // + // var kernelWrapper = new DamMacroStabilityKernelWrapper(); + // + // // Prepare the wrapper. Result is input for the calculation dll + // IKernelDataInput damStabilityInput; + // IKernelDataOutput kernelOutput; + // kernelWrapper.Prepare(damKernelInput, out damStabilityInput, out kernelOutput); + // + // // Validate the input + // List messages; + // kernelWrapper.Validate(damStabilityInput, kernelOutput, out messages); + // Assert.AreEqual(0, messages.Count); + // + // // Run the dll + // kernelWrapper.Execute(damStabilityInput, kernelOutput, out messages); + // DamMacroStabilityOutput damMacroStabilityOutput = (DamMacroStabilityOutput) kernelOutput; + // Assert.AreEqual(0, messages.Count); + // Assert.AreEqual(1.282, damMacroStabilityOutput.Zone1Results.SafetyFactor, diff); + // Assert.IsNull(damMacroStabilityOutput.Zone2Results); + // + // // Fill the design results + // DesignResult result; + // kernelWrapper.PostProcess(damKernelInput, damMacroStabilityOutput, "", out result); + // Assert.AreEqual(1.282, result.StabilityDesignResults.SafetyFactor, diff); + // } + public XDocument ModifiedXmlDocument(string stiFileName) + { + var xmlFileName = Path.Combine(TestFolder, "test.xml"); + var geometryFileName = Path.Combine(TestFolder, "DWP_1.sti"); + var soilDbName = Path.Combine(TestFolder, "DAM Tutorial Design0.soilmaterials.mdb"); // modify name of output sti file XDocument xDocument = XDocument.Load(xmlFileName); XElement inputElement = (from element in xDocument.Root.Descendants() @@ -106,7 +99,20 @@ XAttribute geomFileName = geometryOptionsElement.Attribute(DamMStabAssembler.XmlAttributeSoilGeometry2DFilename); Debug.Assert(geomFileName != null, "geomFileName != null"); geomFileName.Value = geometryFileName; + return xDocument; + } + [Test] + public void TestCreateDGeoStabilityInputFile() + { + var stiFileName = Path.Combine(TestFolder, "test.sti"); + var expectedStiFileName = Path.Combine(TestFolder, "expectedTest.sti"); + if (File.Exists(stiFileName)) + { + File.Delete(stiFileName); + } + + var xDocument = ModifiedXmlDocument(stiFileName); var kernelWrapper = new DamMacroStabilityKernelWrapper(); kernelWrapper.CreateStiFile(xDocument); Assert.IsTrue(File.Exists(stiFileName)); Index: dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs =================================================================== diff -u -r796 -r801 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 796) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/DamMacroStability/MStabXmlDocTests.cs (.../MStabXmlDocTests.cs) (revision 801) @@ -50,6 +50,40 @@ const string soilDbName = @"KernelWrappers\DamMacroStability\TestData\soilmaterials.mdb"; var requiredSafetyFactor = 1.2; +// const string testFolder = @"..\..\Deltares.DamEngine.Calculators.Tests\KernelWrappers\DamMacroStability\TestData"; +// var xmlFileName = Path.Combine(testFolder, "test.xml"); +// var stiFileName = Path.Combine(testFolder, "test.sti"); +// var geometryFileName = Path.Combine(testFolder, "DWP_1.sti"); +// var soilDbName = Path.Combine(testFolder, "DAM Tutorial Design0.soilmaterials.mdb"); +// var expectedStiFileName = Path.Combine(testFolder, "expectedTest.sti"); +// if (File.Exists(stiFileName)) +// { +// File.Delete(stiFileName); +// } +// +// // modify name of output sti file +// XDocument xDocument = XDocument.Load(xmlFileName); +// XElement inputElement = (from element in xDocument.Root.Descendants() +// where element.Name.LocalName == DamMStabAssembler.XmlElementNameInput +// select element).Single(); +// XAttribute mstabFileName = inputElement.Attribute(DamMStabAssembler.XmlAttributeMStabFileName); +// Debug.Assert(mstabFileName != null, "mstabFileName != null"); +// mstabFileName.Value = stiFileName; +// +// // modify name of Soil DB Name +// XAttribute dbName = inputElement.Attribute(DamMStabAssembler.XmlAttributeSoilDBName); +// Debug.Assert(dbName != null, "dbName != null"); +// dbName.Value = soilDbName; +// +// // modify name of geometry input file +// XElement geometryOptionsElement = (from element in inputElement.Descendants() +// where element.Name.LocalName == DamMStabAssembler.XmlElementGeometryCreationOptions +// select element).Single(); +// XAttribute geomFileName = geometryOptionsElement.Attribute(DamMStabAssembler.XmlAttributeSoilGeometry2DFilename); +// Debug.Assert(geomFileName != null, "geomFileName != null"); +// geomFileName.Value = geometryFileName; + + var line = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); var location = new Location(); var scenario = CreateScenarioForLocation(location, line);