public void Create_NaNValues_ReturnGrassCoverErosionInwardsOutputEntity() { // Setup var overtoppingOutput = new OvertoppingOutput(double.NaN, true, double.NaN, null); var dikeHeightOutput = new TestDikeHeightOutput(double.NaN, CalculationConvergence.CalculatedConverged); var overtoppingRateOutput = new TestOvertoppingRateOutput(double.NaN, CalculationConvergence.CalculatedConverged); var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, overtoppingRateOutput); // Call GrassCoverErosionInwardsOutputEntity entity = output.Create(); // Assert Assert.IsNull(entity.WaveHeight); Assert.AreEqual(Convert.ToByte(overtoppingOutput.IsOvertoppingDominant), entity.IsOvertoppingDominant); Assert.IsNull(entity.Reliability); Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity); GrassCoverErosionInwardsDikeHeightOutputEntity dikeHeightEntity = entity.GrassCoverErosionInwardsDikeHeightOutputEntities.Single(); Assert.IsNull(dikeHeightEntity.DikeHeight); Assert.IsNull(dikeHeightEntity.TargetProbability); Assert.IsNull(dikeHeightEntity.TargetReliability); Assert.IsNull(dikeHeightEntity.CalculatedProbability); Assert.IsNull(dikeHeightEntity.CalculatedReliability); Assert.AreEqual((byte)dikeHeightOutput.CalculationConvergence, dikeHeightEntity.CalculationConvergence); GrassCoverErosionInwardsOvertoppingRateOutputEntity overtoppingRateEntity = entity.GrassCoverErosionInwardsOvertoppingRateOutputEntities.Single(); Assert.IsNull(overtoppingRateEntity.OvertoppingRate); Assert.IsNull(overtoppingRateEntity.TargetProbability); Assert.IsNull(overtoppingRateEntity.TargetReliability); Assert.IsNull(overtoppingRateEntity.CalculatedProbability); Assert.IsNull(overtoppingRateEntity.CalculatedReliability); Assert.AreEqual((byte)overtoppingRateOutput.CalculationConvergence, overtoppingRateEntity.CalculationConvergence); }
public void PropertyAttributes_WithDikeHeightAndOvertoppingRateCalculated_ReturnExpectedValues() { // Setup var resultOutput = new OvertoppingOutput(10, true, 0, null); var dikeHeightOutput = new TestDikeHeightOutput(double.NaN); var overtoppingRateOutput = new TestOvertoppingRateOutput(double.NaN); var output = new GrassCoverErosionInwardsOutput(resultOutput, dikeHeightOutput, overtoppingRateOutput); // Call var properties = new GrassCoverErosionInwardsOutputProperties(output); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(16, dynamicProperties.Count); AssertResultOutputProperties(dynamicProperties); AssertDikeHeightOutputProperties(dynamicProperties, firstHydraulicLoadsOutputIndex); AssertOvertoppingRateOutputProperties(dynamicProperties, secondHydraulicLoadsOutputIndex); }
public void Constructor_DikeHeightOutput_ExpectedValues() { // Setup var dikeHeightOutput = new TestDikeHeightOutput(0.5); // Call var properties = new DikeHeightOutputProperties(dikeHeightOutput); // Assert Assert.IsInstanceOf <ObjectProperties <DikeHeightOutput> >(properties); Assert.AreSame(dikeHeightOutput, properties.Data); }
public void IllustrationPoints_WithoutGeneralResult_ReturnsEmptyTopLevelFaultTreeIllustrationPointPropertiesArray() { // Setup var dikeHeightOutput = new TestDikeHeightOutput(0.5); var properties = new DikeHeightOutputProperties(dikeHeightOutput); // Call TopLevelFaultTreeIllustrationPointProperties[] illustrationPoints = properties.IllustrationPoints; // Assert Assert.IsEmpty(illustrationPoints); }
public void Create_OvertoppingRateOutputIsNull_NoOvertoppingRateOutputEntityCreated() { // Setup var overtoppingOutput = new TestOvertoppingOutput(1); var dikeHeightOutput = new TestDikeHeightOutput(double.NaN, CalculationConvergence.CalculatedConverged); var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, null); // Call GrassCoverErosionInwardsOutputEntity entity = output.Create(); // Assert Assert.IsFalse(entity.GrassCoverErosionInwardsOvertoppingRateOutputEntities.Any()); }
public void ParameteredConstructor_DefaultValues() { // Setup var overtoppingOutput = new TestOvertoppingOutput(double.NaN); var dikeHeightOutput = new TestDikeHeightOutput(double.NaN); var overtoppingRateOutput = new TestOvertoppingRateOutput(double.NaN); // Call var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, overtoppingRateOutput); // Assert Assert.IsInstanceOf <ICalculationOutput>(output); Assert.IsInstanceOf <CloneableObservable>(output); Assert.AreSame(overtoppingOutput, output.OvertoppingOutput); Assert.AreSame(dikeHeightOutput, output.DikeHeightOutput); Assert.AreSame(overtoppingRateOutput, output.OvertoppingRateOutput); }
public void CreateInstance_WithContext_NewPropertiesWithData() { // Setup var dikeHeightOutput = new TestDikeHeightOutput(10); var calculation = new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput(new TestOvertoppingOutput(0.5), dikeHeightOutput, null) }; // Call IObjectProperties objectProperties = info.CreateInstance(new DikeHeightOutputContext(calculation)); // Assert Assert.IsInstanceOf <DikeHeightOutputProperties>(objectProperties); Assert.AreSame(dikeHeightOutput, objectProperties.Data); }
public void ClearIllustrationPoints_AllPropertiesSet_IllustrationPointsCleared() { // Setup var overtoppingOutput = new TestOvertoppingOutput(new TestGeneralResultFaultTreeIllustrationPoint()); var dikeHeightOutput = new TestDikeHeightOutput(new TestGeneralResultFaultTreeIllustrationPoint()); var overtoppingRateOutput = new TestOvertoppingRateOutput(new TestGeneralResultFaultTreeIllustrationPoint()); var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, overtoppingRateOutput); // Call output.ClearIllustrationPoints(); // Assert Assert.AreSame(overtoppingOutput, output.OvertoppingOutput); Assert.IsNull(overtoppingOutput.GeneralResult); Assert.AreSame(dikeHeightOutput, output.DikeHeightOutput); Assert.IsNull(dikeHeightOutput.GeneralResult); Assert.AreSame(overtoppingRateOutput, output.OvertoppingRateOutput); Assert.IsNull(overtoppingRateOutput.GeneralResult); }
private static IEnumerable <TestCaseData> GetCalculations() { var overtoppingOutputWithoutGeneralResult = new TestOvertoppingOutput(1.0); var overtoppingOutputWithGeneralResult = new OvertoppingOutput(1.0, true, 1.0, new TestGeneralResultFaultTreeIllustrationPoint()); var dikeHeightOutputWithoutGeneralResult = new TestDikeHeightOutput(1.0); var dikeHeightOutputWithGeneralResult = new TestDikeHeightOutput(new TestGeneralResultFaultTreeIllustrationPoint()); var overtoppingRateOutputWithoutGeneralResult = new TestOvertoppingRateOutput(1.0); var overtoppingRateOutputWithGeneralResult = new TestOvertoppingRateOutput(new TestGeneralResultFaultTreeIllustrationPoint()); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true, ShouldOvertoppingRateBeCalculated = true, ShouldOvertoppingOutputIllustrationPointsBeCalculated = true, ShouldOvertoppingRateIllustrationPointsBeCalculated = true, ShouldDikeHeightIllustrationPointsBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithGeneralResult, dikeHeightOutputWithGeneralResult, overtoppingRateOutputWithGeneralResult) }, false) .SetName("OutputSufficientScenario1")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true, ShouldOvertoppingRateBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, dikeHeightOutputWithoutGeneralResult, overtoppingRateOutputWithoutGeneralResult) }, false) .SetName("OutputSufficientScenario2")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, null, null) }, false) .SetName("OutputSufficientScenario3")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation(), true) .SetName("NoOutputScenario1")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true, ShouldOvertoppingRateBeCalculated = true } }, true) .SetName("NoOutputScenario2")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true, ShouldOvertoppingRateBeCalculated = true, ShouldOvertoppingOutputIllustrationPointsBeCalculated = true, ShouldOvertoppingRateIllustrationPointsBeCalculated = true, ShouldDikeHeightIllustrationPointsBeCalculated = true } }, true) .SetName("NoOutputScenario3")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithGeneralResult, null, null) }, true) .SetName("OvertoppingOutputWithRedundantGeneralResult")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldOvertoppingOutputIllustrationPointsBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, null, null) }, true) .SetName("OvertoppingOutputWithMissingGeneralResult")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, dikeHeightOutputWithGeneralResult, null) }, true) .SetName("DikeHeightOutputWithRedundantGeneralResult")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldDikeHeightBeCalculated = true, ShouldDikeHeightIllustrationPointsBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, dikeHeightOutputWithoutGeneralResult, null) }, true) .SetName("DikeHeightOutputWithMissingGeneralResult")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldOvertoppingRateBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, null, overtoppingRateOutputWithGeneralResult) }, true) .SetName("OvertoppingRateOutputWithRedundantGeneralResult")); yield return(new TestCaseData(new GrassCoverErosionInwardsCalculation { InputParameters = { ShouldOvertoppingRateBeCalculated = true, ShouldOvertoppingRateIllustrationPointsBeCalculated = true }, Output = new GrassCoverErosionInwardsOutput(overtoppingOutputWithoutGeneralResult, null, overtoppingRateOutputWithoutGeneralResult) }, true) .SetName("OvertoppingRateOutputWithMissingGeneralResult")); }
public void PropertyAttributes_HasGeneralResult_ReturnExpectedValues() { // Setup var dikeHeightOutput = new TestDikeHeightOutput(new TestGeneralResultFaultTreeIllustrationPoint()); // Call var properties = new DikeHeightOutputProperties(dikeHeightOutput); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(10, dynamicProperties.Count); PropertyDescriptor dikeHeightProperty = dynamicProperties[dikeHeightPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dikeHeightProperty, dikeHeightCategory, "HBN [m+NAP]", "Het berekende Hydraulisch Belasting Niveau (HBN).", true); PropertyDescriptor targetProbability = dynamicProperties[targetProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbability, dikeHeightCategory, "Doelkans [1/jaar]", "De ingevoerde kans waarvoor het resultaat moet worden berekend.", true); PropertyDescriptor targetReliability = dynamicProperties[targetReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliability, dikeHeightCategory, "Betrouwbaarheidsindex doelkans [-]", "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", true); PropertyDescriptor calculatedProbability = dynamicProperties[calculatedProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbability, dikeHeightCategory, "Berekende kans [1/jaar]", "De berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor calculatedReliability = dynamicProperties[calculatedReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliability, dikeHeightCategory, "Betrouwbaarheidsindex berekende kans [-]", "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor calculationConvergence = dynamicProperties[convergencePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculationConvergence, dikeHeightCategory, "Convergentie", "Is convergentie bereikt in de HBN berekening?", true); PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, illustrationPointsCategoryName, "Maatgevende windrichting", "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.", true); PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, illustrationPointsCategoryName, "Invloedscoëfficiënten [-]", "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", true); PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, illustrationPointsCategoryName, "Tijdsduren [uur]", "Tijdsduren waarop de stochasten betrekking hebben.", true); PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty, illustrationPointsCategoryName, "Illustratiepunten", "De lijst van illustratiepunten voor de berekening.", true); }
public void PropertyAttributes_NoGeneralResult_ReturnExpectedValues() { // Setup var dikeHeightOutput = new TestDikeHeightOutput(10); // Call var properties = new DikeHeightOutputProperties(dikeHeightOutput); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(6, dynamicProperties.Count); PropertyDescriptor dikeHeightProperty = dynamicProperties[dikeHeightPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dikeHeightProperty, dikeHeightCategory, "HBN [m+NAP]", "Het berekende Hydraulisch Belasting Niveau (HBN).", true); PropertyDescriptor targetProbability = dynamicProperties[targetProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbability, dikeHeightCategory, "Doelkans [1/jaar]", "De ingevoerde kans waarvoor het resultaat moet worden berekend.", true); PropertyDescriptor targetReliability = dynamicProperties[targetReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliability, dikeHeightCategory, "Betrouwbaarheidsindex doelkans [-]", "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", true); PropertyDescriptor calculatedProbability = dynamicProperties[calculatedProbabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbability, dikeHeightCategory, "Berekende kans [1/jaar]", "De berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor calculatedReliability = dynamicProperties[calculatedReliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliability, dikeHeightCategory, "Betrouwbaarheidsindex berekende kans [-]", "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor calculationConvergence = dynamicProperties[convergencePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculationConvergence, dikeHeightCategory, "Convergentie", "Is convergentie bereikt in de HBN berekening?", true); }