public void SynchronizeStructureInput_ChangedStructure_ExpectedValues() { // Setup var differentStructure = new HeightStructure(new HeightStructure.ConstructionProperties { Id = "Test id", Name = "Test name", Location = new Point2D(-1, -1) }); var input = new HeightStructuresInput { Structure = new TestHeightStructure() }; input.Structure.CopyProperties(differentStructure); // Precondition AssertHeightStructureInput(new TestHeightStructure(), input); // Call input.SynchronizeStructureInput(); // Assert AssertHeightStructureInput(differentStructure, input); }
public void Constructor_ExpectedValues() { // Call var input = new HeightStructuresInput(); // Assert Assert.IsInstanceOf <StructuresInputBase <HeightStructure> >(input); var expectedModelFactorSuperCriticalFlow = new NormalDistribution(2) { Mean = (RoundedDouble)1.1, StandardDeviation = (RoundedDouble)0.05 }; var expectedLevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; DistributionAssert.AreEqual(expectedModelFactorSuperCriticalFlow, input.ModelFactorSuperCriticalFlow); DistributionAssert.AreEqual(expectedLevelCrestStructure, input.LevelCrestStructure); Assert.AreEqual(2, input.DeviationWaveDirection.NumberOfDecimalPlaces); Assert.AreEqual(0.0, input.DeviationWaveDirection, input.DeviationWaveDirection.GetAccuracy()); }
public void GivenInputWithStructure_WhenStructureNull_ThenSchematizationPropertiesSynedToDefaults() { // Given var structure = new TestHeightStructure(); var input = new HeightStructuresInput { Structure = structure }; RoundedDouble expectedDeviationWaveDirection = input.DeviationWaveDirection; NormalDistribution expectedModelFactorSuperCriticalFlow = input.ModelFactorSuperCriticalFlow; // Precondition AssertHeightStructureInput(structure, input); // When input.Structure = null; // Then AssertAreEqual(expectedDeviationWaveDirection, input.DeviationWaveDirection); DistributionAssert.AreEqual(expectedModelFactorSuperCriticalFlow, input.ModelFactorSuperCriticalFlow); Assert.AreEqual(1.0, input.FailureProbabilityStructureWithErosion); var expectedLevelCrestStructure = new NormalDistribution(2) { Mean = RoundedDouble.NaN, StandardDeviation = RoundedDouble.NaN }; DistributionAssert.AreEqual(expectedLevelCrestStructure, input.LevelCrestStructure); }
public void LevelCrestStructure_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new HeightStructuresInput(); var mean = (RoundedDouble)(0.01 + random.NextDouble()); var standardDeviation = (RoundedDouble)(0.01 + random.NextDouble()); var distributionToSet = new NormalDistribution(5) { Mean = mean, StandardDeviation = standardDeviation }; // Call input.LevelCrestStructure = distributionToSet; // Assert var expectedDistribution = new NormalDistribution(2) { Mean = mean, StandardDeviation = standardDeviation }; DistributionTestHelper.AssertDistributionCorrectlySet(input.LevelCrestStructure, distributionToSet, expectedDistribution); }
private void SetPropertyAndVerifyNotificationsAndOutput(Action <HeightStructuresInputContextProperties> setProperty) { // Setup var observable = mockRepository.StrictMock <IObservable>(); observable.Expect(o => o.NotifyObservers()); mockRepository.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new StructuresCalculation <HeightStructuresInput>(); HeightStructuresInput input = calculation.InputParameters; input.ForeshoreProfile = new TestForeshoreProfile(); input.Structure = new TestHeightStructure(); var customHandler = new SetPropertyValueAfterConfirmationParameterTester(new[] { observable }); var inputContext = new HeightStructuresInputContext(input, calculation, failureMechanism, assessmentSection); var properties = new HeightStructuresInputContextProperties(inputContext, customHandler); // Call setProperty(properties); // Assert Assert.IsFalse(calculation.HasOutput); mockRepository.VerifyAll(); }
private static void AssertHeightStructureInput(HeightStructure expectedHeightStructure, HeightStructuresInput input) { if (expectedHeightStructure == null) { Assert.IsNull(input.Structure); var defaultInput = new HeightStructuresInput(); AssertAreEqual(defaultInput.StructureNormalOrientation, input.StructureNormalOrientation); DistributionAssert.AreEqual(defaultInput.LevelCrestStructure, input.LevelCrestStructure); DistributionAssert.AreEqual(defaultInput.CriticalOvertoppingDischarge, input.CriticalOvertoppingDischarge); DistributionAssert.AreEqual(defaultInput.WidthFlowApertures, input.WidthFlowApertures); Assert.AreEqual(defaultInput.FailureProbabilityStructureWithErosion, input.FailureProbabilityStructureWithErosion); DistributionAssert.AreEqual(defaultInput.StorageStructureArea, input.StorageStructureArea); DistributionAssert.AreEqual(defaultInput.AllowedLevelIncreaseStorage, input.AllowedLevelIncreaseStorage); } else { AssertAreEqual(expectedHeightStructure.StructureNormalOrientation, input.StructureNormalOrientation); DistributionAssert.AreEqual(expectedHeightStructure.LevelCrestStructure, input.LevelCrestStructure); DistributionAssert.AreEqual(expectedHeightStructure.CriticalOvertoppingDischarge, input.CriticalOvertoppingDischarge); DistributionAssert.AreEqual(expectedHeightStructure.WidthFlowApertures, input.WidthFlowApertures); Assert.AreEqual(expectedHeightStructure.FailureProbabilityStructureWithErosion, input.FailureProbabilityStructureWithErosion); DistributionAssert.AreEqual(expectedHeightStructure.StorageStructureArea, input.StorageStructureArea); DistributionAssert.AreEqual(expectedHeightStructure.AllowedLevelIncreaseStorage, input.AllowedLevelIncreaseStorage); } }
/// <summary> /// Method that asserts whether <paramref name="original"/> and <paramref name="clone"/> /// are clones. /// </summary> /// <param name="original">The original object.</param> /// <param name="clone">The cloned object.</param> /// <exception cref="AssertionException">Thrown when <paramref name="original"/> and /// <paramref name="clone"/> are not clones.</exception> public static void AreClones(HeightStructuresInput original, HeightStructuresInput clone) { CommonCloneAssert.AreClones(original, clone); Assert.AreEqual(original.DeviationWaveDirection, clone.DeviationWaveDirection); CoreCloneAssert.AreObjectClones(original.ModelFactorSuperCriticalFlow, clone.ModelFactorSuperCriticalFlow, DistributionAssert.AreEqual); CoreCloneAssert.AreObjectClones(original.LevelCrestStructure, clone.LevelCrestStructure, DistributionAssert.AreEqual); }
public void Structure_Null_ExpectedValues() { // Setup var input = new HeightStructuresInput(); // Call input.Structure = null; // Assert AssertHeightStructureInput(null, input); }
public void SynchronizeStructureInput_StructureNotSet_ExpectedValues() { // Setup var input = new HeightStructuresInput(); // Call input.SynchronizeStructureInput(); // Assert AssertHeightStructureInput(null, input); }
public void IsStructureInputSynchronized_StructureNotSet_ReturnFalse() { // Setup var input = new HeightStructuresInput(); // Call bool isStructureInputSynchronized = input.IsStructureInputSynchronized; // Assert Assert.IsFalse(isStructureInputSynchronized); }
public void Structure_NotNull_ExpectedValues() { // Setup var input = new HeightStructuresInput(); var structure = new TestHeightStructure(); // Call input.Structure = structure; // Assert AssertHeightStructureInput(structure, input); }
public void Clone_Always_ReturnNewInstanceWithCopiedValues() { // Setup var original = new HeightStructuresInput(); HeightStructuresTestDataGenerator.SetRandomDataToHeightStructuresInput(original); // Call object clone = original.Clone(); // Assert CoreCloneAssert.AreObjectClones(original, clone, HeightStructuresCloneAssert.AreClones); }
public void DeviationWaveDirection_InvalidValues_ThrowsArgumentOutOfRangeException(double invalidValue) { // Setup var input = new HeightStructuresInput(); // Call TestDelegate call = () => input.DeviationWaveDirection = (RoundedDouble)invalidValue; // Assert const string expectedMessage = "De waarde voor de afwijking van de golfrichting moet in het bereik [-360,00, 360,00] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(call, expectedMessage); }
public void DeviationWaveDirection_ValidValues_ExpectedValues(double validValue) { // Setup var input = new HeightStructuresInput(); var deviationWaveDirection = new RoundedDouble(5, validValue); // Call input.DeviationWaveDirection = deviationWaveDirection; // Assert Assert.AreEqual(2, input.DeviationWaveDirection.NumberOfDecimalPlaces); AssertAreEqual(deviationWaveDirection, input.DeviationWaveDirection); }
public void IsStructureInputSynchronized_StructureAndInputInSync_ReturnTrue() { // Setup var structure = new TestHeightStructure(); var input = new HeightStructuresInput { Structure = structure }; // Call bool isStructureInputSynchronized = input.IsStructureInputSynchronized; // Assert Assert.IsTrue(isStructureInputSynchronized); }
private static void ReadInputParameters(HeightStructuresInput inputParameters, HeightStructuresCalculationEntity entity, ReadConversionCollector collector) { if (entity.HeightStructureEntity != null) { inputParameters.Structure = entity.HeightStructureEntity.Read(collector); } entity.Read(inputParameters, collector); inputParameters.DeviationWaveDirection = (RoundedDouble)entity.DeviationWaveDirection.ToNullAsNaN(); inputParameters.ModelFactorSuperCriticalFlow.Mean = (RoundedDouble)entity.ModelFactorSuperCriticalFlowMean.ToNullAsNaN(); inputParameters.LevelCrestStructure.Mean = (RoundedDouble)entity.LevelCrestStructureMean.ToNullAsNaN(); inputParameters.LevelCrestStructure.StandardDeviation = (RoundedDouble)entity.LevelCrestStructureStandardDeviation.ToNullAsNaN(); }
public void IsStructureInputSynchronized_StructureAndInputNotInSync_ReturnFalse(HeightStructure modifiedStructure) { // Setup var structure = new TestHeightStructure(); var input = new HeightStructuresInput { Structure = structure }; structure.CopyProperties(modifiedStructure); // Call bool isStructureInputSynchronized = input.IsStructureInputSynchronized; // Assert Assert.IsFalse(isStructureInputSynchronized); }
public void Read_EntityWithNullParameters_ReturnHeightStructuresCalculationWithInputParametersNaN() { // Setup var entity = new HeightStructuresCalculationEntity { ScenarioContribution = 0, StructureNormalOrientation = null, ModelFactorSuperCriticalFlowMean = null, AllowedLevelIncreaseStorageMean = null, AllowedLevelIncreaseStorageStandardDeviation = null, FlowWidthAtBottomProtectionMean = null, FlowWidthAtBottomProtectionStandardDeviation = null, CriticalOvertoppingDischargeMean = null, CriticalOvertoppingDischargeCoefficientOfVariation = null, WidthFlowAperturesMean = null, WidthFlowAperturesStandardDeviation = null, StormDurationMean = null, LevelCrestStructureMean = null, LevelCrestStructureStandardDeviation = null, DeviationWaveDirection = null }; var collector = new ReadConversionCollector(); // Call StructuresCalculationScenario <HeightStructuresInput> calculation = entity.Read(collector); // Assert HeightStructuresInput inputParameters = calculation.InputParameters; Assert.IsNaN(inputParameters.StructureNormalOrientation); Assert.IsNaN(inputParameters.ModelFactorSuperCriticalFlow.Mean); Assert.IsNaN(inputParameters.AllowedLevelIncreaseStorage.Mean); Assert.IsNaN(inputParameters.AllowedLevelIncreaseStorage.StandardDeviation); Assert.IsNaN(inputParameters.FlowWidthAtBottomProtection.Mean); Assert.IsNaN(inputParameters.FlowWidthAtBottomProtection.StandardDeviation); Assert.IsNaN(inputParameters.CriticalOvertoppingDischarge.Mean); Assert.IsNaN(inputParameters.CriticalOvertoppingDischarge.CoefficientOfVariation); Assert.IsNaN(inputParameters.WidthFlowApertures.Mean); Assert.IsNaN(inputParameters.WidthFlowApertures.StandardDeviation); Assert.IsNaN(inputParameters.StormDuration.Mean); Assert.IsNaN(inputParameters.LevelCrestStructure.Mean); Assert.IsNaN(inputParameters.LevelCrestStructure.StandardDeviation); Assert.IsNaN(inputParameters.DeviationWaveDirection); }
public void Read_EntityWithForeshoreProfile_ReturnCalculation(bool flagUsage, BreakWaterType type, int randomSeed) { // Setup var random = new Random(randomSeed); double breakWaterHeight = random.NextDouble(); var points = new[] { new Point2D(0, 0) }; string pointXml = new Point2DCollectionXmlSerializer().ToXml(points); var foreshoreEntity = new ForeshoreProfileEntity { Id = "id", BreakWaterHeight = breakWaterHeight, BreakWaterType = Convert.ToByte(type), GeometryXml = pointXml }; var entity = new HeightStructuresCalculationEntity { UseForeshore = Convert.ToByte(flagUsage), UseBreakWater = Convert.ToByte(!flagUsage), ForeshoreProfileEntity = foreshoreEntity, BreakWaterType = Convert.ToByte(type), BreakWaterHeight = breakWaterHeight, ScenarioContribution = 0 }; var collector = new ReadConversionCollector(); // Call StructuresCalculationScenario <HeightStructuresInput> calculation = entity.Read(collector); // Assert HeightStructuresInput input = calculation.InputParameters; Assert.AreEqual(flagUsage, input.UseForeshore); Assert.AreEqual(!flagUsage, input.UseBreakWater); Assert.AreEqual(type, input.BreakWater.Type); Assert.AreEqual(breakWaterHeight, input.BreakWater.Height, input.BreakWater.Height.GetAccuracy()); CollectionAssert.AreEqual(points, input.ForeshoreProfile.Geometry); Assert.IsNotNull(input.ForeshoreProfile); }
/// <summary> /// This method sets random data values to all properties of <paramref name="input"/>. /// </summary> /// <param name="input">The input to set the random data values to.</param> public static void SetRandomDataToHeightStructuresInput(HeightStructuresInput input) { var random = new Random(21); input.Structure = new TestHeightStructure(); input.DeviationWaveDirection = random.NextRoundedDouble(); input.ModelFactorSuperCriticalFlow = new NormalDistribution { Mean = random.NextRoundedDouble() }; input.LevelCrestStructure = new NormalDistribution { Mean = random.NextRoundedDouble(), StandardDeviation = random.NextRoundedDouble() }; CommonTestDataGenerator.SetRandomDataToStructuresInput(input); }
public void ModelFactorSuperCriticalFlow_Always_ExpectedValues() { // Setup var random = new Random(22); var input = new HeightStructuresInput(); RoundedDouble mean = random.NextRoundedDouble(0.01, 1.0); var expectedDistribution = new NormalDistribution(2) { Mean = mean, StandardDeviation = input.ModelFactorSuperCriticalFlow.StandardDeviation }; var distributionToSet = new NormalDistribution(5) { Mean = mean, StandardDeviation = random.NextRoundedDouble() }; // Call input.ModelFactorSuperCriticalFlow = distributionToSet; // Assert DistributionTestHelper.AssertDistributionCorrectlySet(input.ModelFactorSuperCriticalFlow, distributionToSet, expectedDistribution); }
public void Constructor_WithData_ExpectedValues() { // Setup var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); var calculation = new StructuresCalculation <HeightStructuresInput> { InputParameters = { HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(), Structure = new TestHeightStructure(), ForeshoreProfile = new TestForeshoreProfile() } }; var inputContext = new HeightStructuresInputContext(calculation.InputParameters, calculation, failureMechanism, assessmentSection); // Call var properties = new HeightStructuresInputContextProperties(inputContext, handler); // Assert Assert.IsInstanceOf <StructuresInputBaseProperties <HeightStructure, HeightStructuresInput, StructuresCalculation <HeightStructuresInput>, HeightStructuresFailureMechanism> >(properties); Assert.AreSame(inputContext, properties.Data); HeightStructuresInput input = calculation.InputParameters; Assert.AreSame(input.Structure, properties.Structure); Assert.AreEqual(input.Structure.Location.X, properties.StructureLocation.X, 1); Assert.AreEqual(input.Structure.Location.Y, properties.StructureLocation.Y, 1); Assert.AreSame(input.HydraulicBoundaryLocation, properties.SelectedHydraulicBoundaryLocation.HydraulicBoundaryLocation); Assert.AreSame(input.ModelFactorSuperCriticalFlow, properties.ModelFactorSuperCriticalFlow.Data); Assert.AreEqual(input.StructureNormalOrientation, properties.StructureNormalOrientation); Assert.AreSame(input.LevelCrestStructure, properties.LevelCrestStructure.Data); Assert.AreSame(input.WidthFlowApertures, properties.WidthFlowApertures.Data); Assert.AreSame(input.StormDuration, properties.StormDuration.Data); Assert.AreSame(input.CriticalOvertoppingDischarge, properties.CriticalOvertoppingDischarge.Data); Assert.AreSame(input.FlowWidthAtBottomProtection, properties.FlowWidthAtBottomProtection.Data); Assert.AreEqual(input.FailureProbabilityStructureWithErosion, properties.FailureProbabilityStructureWithErosion); Assert.AreSame(input.StorageStructureArea, properties.StorageStructureArea.Data); Assert.AreSame(input.AllowedLevelIncreaseStorage, properties.AllowedLevelIncreaseStorage.Data); Assert.AreSame(input.ForeshoreProfile, properties.ForeshoreProfile); Assert.IsInstanceOf <UseBreakWaterProperties>(properties.UseBreakWater); Assert.IsInstanceOf <UseForeshoreProperties>(properties.UseForeshore); Assert.AreEqual(input.ShouldIllustrationPointsBeCalculated, properties.ShouldIllustrationPointsBeCalculated); TestHelper.AssertTypeConverter <HeightStructuresInputContextProperties, NoProbabilityValueDoubleConverter>( nameof(HeightStructuresInputContextProperties.FailureProbabilityStructureWithErosion)); DistributionPropertiesTestHelper.AssertPropertiesAreReadOnly(properties.ModelFactorSuperCriticalFlow, false, true); mockRepository.VerifyAll(); }
public void Calculate_VariousCalculationsWithBreakWater_InputPropertiesCorrectlySentToCalculator(BreakWaterType breakWaterType) { // Setup var failureMechanism = new HeightStructuresFailureMechanism(); var mockRepository = new MockRepository(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mockRepository); var calculator = new TestStructuresCalculator <StructuresOvertoppingCalculationInput>(); var calculatorFactory = mockRepository.StrictMock <IHydraRingCalculatorFactory>(); calculatorFactory.Expect(cf => cf.CreateStructuresCalculator <StructuresOvertoppingCalculationInput>(null)) .IgnoreArguments() .Return(calculator); mockRepository.ReplayAll(); var calculation = new TestHeightStructuresCalculationScenario { InputParameters = { HydraulicBoundaryLocation = assessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001), ForeshoreProfile = new TestForeshoreProfile(true) { BreakWater = { Type = breakWaterType } } } }; using (new HydraRingCalculatorFactoryConfig(calculatorFactory)) { // Call new HeightStructuresCalculationService().Calculate(calculation, failureMechanism.GeneralInput, CreateCalculationSettings()); // Assert StructuresOvertoppingCalculationInput[] overtoppingCalculationInputs = calculator.ReceivedInputs.ToArray(); Assert.AreEqual(1, overtoppingCalculationInputs.Length); GeneralHeightStructuresInput generalInput = failureMechanism.GeneralInput; HeightStructuresInput input = calculation.InputParameters; var expectedInput = new StructuresOvertoppingCalculationInput( 1300001, input.StructureNormalOrientation, input.ForeshoreGeometry.Select(c => new HydraRingForelandPoint(c.X, c.Y)), new HydraRingBreakWater(BreakWaterTypeHelper.GetHydraRingBreakWaterType(breakWaterType), input.BreakWater.Height), generalInput.GravitationalAcceleration, generalInput.ModelFactorOvertoppingFlow.Mean, generalInput.ModelFactorOvertoppingFlow.StandardDeviation, input.LevelCrestStructure.Mean, input.LevelCrestStructure.StandardDeviation, input.StructureNormalOrientation, input.ModelFactorSuperCriticalFlow.Mean, input.ModelFactorSuperCriticalFlow.StandardDeviation, input.AllowedLevelIncreaseStorage.Mean, input.AllowedLevelIncreaseStorage.StandardDeviation, generalInput.ModelFactorStorageVolume.Mean, generalInput.ModelFactorStorageVolume.StandardDeviation, input.StorageStructureArea.Mean, input.StorageStructureArea.CoefficientOfVariation, generalInput.ModelFactorInflowVolume, input.FlowWidthAtBottomProtection.Mean, input.FlowWidthAtBottomProtection.StandardDeviation, input.CriticalOvertoppingDischarge.Mean, input.CriticalOvertoppingDischarge.CoefficientOfVariation, input.FailureProbabilityStructureWithErosion, input.WidthFlowApertures.Mean, input.WidthFlowApertures.StandardDeviation, input.DeviationWaveDirection, input.StormDuration.Mean, input.StormDuration.CoefficientOfVariation); StructuresOvertoppingCalculationInput actualInput = overtoppingCalculationInputs[0]; HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); Assert.IsFalse(calculator.IsCanceled); } mockRepository.VerifyAll(); }
public void Read_ValidEntity_ReturnCalculation(string name, string comments, int randomSeed) { // Setup var random = new Random(randomSeed); var entity = new HeightStructuresCalculationEntity { Name = name, RelevantForScenario = Convert.ToByte(true), ScenarioContribution = random.NextDouble(), Comments = comments, UseForeshore = Convert.ToByte(false), UseBreakWater = Convert.ToByte(false), StructureNormalOrientation = random.NextDouble(0, 360), ModelFactorSuperCriticalFlowMean = random.NextDouble(-9999.9999, 9999.9999), AllowedLevelIncreaseStorageMean = random.NextDouble(1e-6, 9999.9999), AllowedLevelIncreaseStorageStandardDeviation = random.NextDouble(1e-6, 9999.9999), FlowWidthAtBottomProtectionMean = random.NextDouble(1e-6, 9999.9999), FlowWidthAtBottomProtectionStandardDeviation = random.NextDouble(1e-6, 9999.9999), CriticalOvertoppingDischargeMean = random.NextDouble(1e-6, 9999.9999), CriticalOvertoppingDischargeCoefficientOfVariation = random.NextDouble(1e-6, 9999.9999), FailureProbabilityStructureWithErosion = random.NextDouble(), WidthFlowAperturesMean = random.NextDouble(1e-6, 9999.9999), WidthFlowAperturesStandardDeviation = random.NextDouble(1e-6, 9999.9999), StormDurationMean = random.NextDouble(1e-6, 9999.9999), LevelCrestStructureMean = random.NextDouble(1e-6, 9999.9999), LevelCrestStructureStandardDeviation = random.NextDouble(1e-6, 9999.9999), DeviationWaveDirection = random.NextDouble(-360, 360) }; var collector = new ReadConversionCollector(); // Call StructuresCalculationScenario <HeightStructuresInput> calculation = entity.Read(collector); // Assert Assert.AreEqual(name, calculation.Name); Assert.AreEqual(Convert.ToBoolean(entity.RelevantForScenario), calculation.IsRelevant); RoundedDoubleTestHelper.AssertRoundedDouble(entity.ScenarioContribution, calculation.Contribution); Assert.AreEqual(comments, calculation.Comments.Body); HeightStructuresInput input = calculation.InputParameters; Assert.IsFalse(input.UseForeshore); Assert.IsFalse(input.UseBreakWater); RoundedDoubleTestHelper.AssertRoundedDouble(entity.StructureNormalOrientation, input.StructureNormalOrientation); RoundedDoubleTestHelper.AssertRoundedDouble(entity.ModelFactorSuperCriticalFlowMean, input.ModelFactorSuperCriticalFlow.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.AllowedLevelIncreaseStorageMean, input.AllowedLevelIncreaseStorage.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.AllowedLevelIncreaseStorageStandardDeviation, input.AllowedLevelIncreaseStorage.StandardDeviation); RoundedDoubleTestHelper.AssertRoundedDouble(entity.FlowWidthAtBottomProtectionMean, input.FlowWidthAtBottomProtection.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.FlowWidthAtBottomProtectionStandardDeviation, input.FlowWidthAtBottomProtection.StandardDeviation); RoundedDoubleTestHelper.AssertRoundedDouble(entity.CriticalOvertoppingDischargeMean, input.CriticalOvertoppingDischarge.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.CriticalOvertoppingDischargeCoefficientOfVariation, input.CriticalOvertoppingDischarge.CoefficientOfVariation); Assert.AreEqual(entity.FailureProbabilityStructureWithErosion, input.FailureProbabilityStructureWithErosion); RoundedDoubleTestHelper.AssertRoundedDouble(entity.WidthFlowAperturesMean, input.WidthFlowApertures.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.WidthFlowAperturesStandardDeviation, input.WidthFlowApertures.StandardDeviation); RoundedDoubleTestHelper.AssertRoundedDouble(entity.StormDurationMean, input.StormDuration.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.LevelCrestStructureMean, input.LevelCrestStructure.Mean); RoundedDoubleTestHelper.AssertRoundedDouble(entity.LevelCrestStructureStandardDeviation, input.LevelCrestStructure.StandardDeviation); RoundedDoubleTestHelper.AssertRoundedDouble(entity.DeviationWaveDirection, input.DeviationWaveDirection); CollectionAssert.IsEmpty(input.ForeshoreGeometry); Assert.IsNull(input.ForeshoreProfile); Assert.IsNull(input.HydraulicBoundaryLocation); Assert.IsNull(input.Structure); Assert.IsFalse(calculation.HasOutput); }
private static void SetHeightStructuresInputValues(HeightStructuresCalculationEntity entity, HeightStructuresInput input, PersistenceRegistry registry) { input.Create(entity, registry); if (input.Structure != null) { entity.HeightStructureEntity = registry.Get(input.Structure); } entity.DeviationWaveDirection = input.DeviationWaveDirection.ToNaNAsNull(); entity.ModelFactorSuperCriticalFlowMean = input.ModelFactorSuperCriticalFlow.Mean.ToNaNAsNull(); entity.LevelCrestStructureMean = input.LevelCrestStructure.Mean.ToNaNAsNull(); entity.LevelCrestStructureStandardDeviation = input.LevelCrestStructure.StandardDeviation.ToNaNAsNull(); }