public void Import_UseForeshoreFalseButProfileWithoutForeshoreGeometry_DataAddedToModel() { // Setup string filePath = Path.Combine(path, "validConfigurationCalculationUseForeshoreFalseForeshoreProfileWithoutGeometry.xml"); var calculationGroup = new CalculationGroup(); var foreshoreProfile = new TestForeshoreProfile("Voorlandprofiel"); var importer = new TestWaveConditionsCalculationConfigurationImporter( filePath, calculationGroup, Enumerable.Empty <HydraulicBoundaryLocation>(), new[] { foreshoreProfile }, new FailureMechanismContribution(0.1, 0.1), Enumerable.Empty <HydraulicBoundaryLocationCalculationsForTargetProbability>()); // Call bool successful = importer.Import(); // Assert Assert.IsTrue(successful); var expectedCalculation = new TestTargetTestWaveConditionsCalculation { Name = "Berekening 1", InputParameters = { UseForeshore = false, Orientation = (RoundedDouble)0, ForeshoreProfile = foreshoreProfile, WaterLevelType = WaveConditionsInputWaterLevelType.MaximumAllowableFloodingProbability } }; Assert.AreEqual(1, calculationGroup.Children.Count); AssertWaveConditionsCalculation(expectedCalculation, (ICalculation <WaveConditionsInput>)calculationGroup.Children[0]); }
public void Import_ValidConfigurationWithValidData_DataAddedToModel(FailureMechanismContribution failureMechanismContribution, HydraulicBoundaryLocationCalculationsForTargetProbability calculationsForTargetProbability, WaveConditionsInputWaterLevelType expectedWaterLevelType) { // Setup string filePath = Path.Combine(path, "validConfigurationFullCalculation.xml"); var calculationGroup = new CalculationGroup(); var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "Locatie", 10, 20); var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), new[] { new Point2D(0, 0), new Point2D(1, 1), new Point2D(2, 2) }, new BreakWater(BreakWaterType.Caisson, 0), new ForeshoreProfile.ConstructionProperties { Id = "Voorlandprofiel", Name = "VoorlandProfielName" }); var importer = new TestWaveConditionsCalculationConfigurationImporter( filePath, calculationGroup, new[] { hydraulicBoundaryLocation }, new[] { foreshoreProfile }, failureMechanismContribution, new[] { calculationsForTargetProbability }); // Call var successful = false; Action call = () => successful = importer.Import(); // Assert TestHelper.AssertLogMessageIsGenerated(call, $"Gegevens zijn geïmporteerd vanuit bestand '{filePath}'.", 1); Assert.IsTrue(successful); var expectedCalculation = new TestTargetTestWaveConditionsCalculation { Name = "Berekening 1", InputParameters = { HydraulicBoundaryLocation = hydraulicBoundaryLocation, CalculationsTargetProbability = expectedWaterLevelType == WaveConditionsInputWaterLevelType.UserDefinedTargetProbability ? calculationsForTargetProbability : null, WaterLevelType = expectedWaterLevelType, UpperBoundaryRevetment = (RoundedDouble)10, LowerBoundaryRevetment = (RoundedDouble)2, UpperBoundaryWaterLevels = (RoundedDouble)9, LowerBoundaryWaterLevels = (RoundedDouble)4, StepSize = WaveConditionsInputStepSize.Half, ForeshoreProfile = foreshoreProfile, Orientation = (RoundedDouble)5.5, UseForeshore = false, UseBreakWater = true, BreakWater = { Height = (RoundedDouble)6.6, Type = BreakWaterType.Caisson } } }; Assert.AreEqual(1, calculationGroup.Children.Count); AssertWaveConditionsCalculation(expectedCalculation, (ICalculation <WaveConditionsInput>)calculationGroup.Children[0]); }