/// <summary> /// Gets the validation rules applicable for low sill calculations. /// </summary> /// <param name="input">The <see cref="StabilityPointStructuresInput"/> to base the validation rules on.</param> /// <returns>An <see cref="IEnumerable{T}"/> of validation rules to validate a flooded culvert input.</returns> /// <exception cref="InvalidEnumArgumentException">Thrown when <paramref name="input"/> contains /// an invalid value of <see cref="LoadSchematizationType"/>.</exception> /// <exception cref="NotSupportedException">Thrown when<paramref name="input"/> contains /// an unsupported value of <see cref="LoadSchematizationType"/>.</exception> private static IEnumerable <ValidationRule> GetLowSillValidationRules(StabilityPointStructuresInput input) { LoadSchematizationType loadSchematizationType = input.LoadSchematizationType; if (!Enum.IsDefined(typeof(LoadSchematizationType), loadSchematizationType)) { throw new InvalidEnumArgumentException(nameof(input), (int)loadSchematizationType, typeof(LoadSchematizationType)); } switch (loadSchematizationType) { case LoadSchematizationType.Linear: return(GetLowSillLinearValidationRules(input)); case LoadSchematizationType.Quadratic: return(GetLowSillQuadraticValidationRules(input)); default: throw new NotSupportedException(); } }
public void GetValidationRules_InflowModelTypeFloodedCulvert_ReturnValidationRules(LoadSchematizationType loadSchematizationType) { // Setup var registry = new StabilityPointStructuresValidationRulesRegistry(); // Call IEnumerable <ValidationRule> rules = registry.GetValidationRules(new StabilityPointStructuresInput { InflowModelType = StabilityPointStructureInflowModelType.FloodedCulvert, LoadSchematizationType = loadSchematizationType }); // Assert ValidationRule[] validationRules = rules.ToArray(); Assert.AreEqual(24, validationRules.Length); Assert.IsInstanceOf <UseBreakWaterRule>(validationRules[0]); Assert.IsInstanceOf <NumericInputRule>(validationRules[1]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[2]); Assert.IsInstanceOf <NormalDistributionRule>(validationRules[3]); Assert.IsInstanceOf <NormalDistributionRule>(validationRules[4]); Assert.IsInstanceOf <VariationCoefficientNormalDistributionRule>(validationRules[5]); Assert.IsInstanceOf <LogNormalDistributionRule>(validationRules[6]); Assert.IsInstanceOf <NumericInputRule>(validationRules[7]); Assert.IsInstanceOf <NumericInputRule>(validationRules[8]); Assert.IsInstanceOf <LogNormalDistributionRule>(validationRules[9]); Assert.IsInstanceOf <LogNormalDistributionRule>(validationRules[10]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[11]); Assert.IsInstanceOf <LogNormalDistributionRule>(validationRules[12]); Assert.IsInstanceOf <NormalDistributionRule>(validationRules[13]); Assert.IsInstanceOf <NormalDistributionRule>(validationRules[14]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[15]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[16]); Assert.IsInstanceOf <NormalDistributionRule>(validationRules[17]); Assert.IsInstanceOf <NumericInputRule>(validationRules[18]); Assert.IsInstanceOf <NumericInputRule>(validationRules[19]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[20]); Assert.IsInstanceOf <VariationCoefficientNormalDistributionRule>(validationRules[21]); Assert.IsInstanceOf <VariationCoefficientNormalDistributionRule>(validationRules[22]); Assert.IsInstanceOf <VariationCoefficientLogNormalDistributionRule>(validationRules[23]); }
public void LoadSchematizationType_ChangeToEqualValue_NoNotificationsAndOutputNotCleared(LoadSchematizationType breakWaterType) { // Call AssertPropertyNotChanged( row => { breakWaterType = row.LoadSchematizationType; row.LoadSchematizationType = row.LoadSchematizationType; }, calculation => { // Assert Assert.NotNull(breakWaterType); Assert.AreEqual(breakWaterType, calculation.InputParameters.LoadSchematizationType); }); }
public void LoadSchematizationType_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged(LoadSchematizationType loadSchematizationType, LoadSchematizationType newLoadSchematizationType) { // Setup var calculation = new StructuresCalculationScenario <StabilityPointStructuresInput> { InputParameters = { LoadSchematizationType = loadSchematizationType } }; // Call & Assert SetPropertyAndVerifyNotificationsAndOutputForCalculation(row => row.LoadSchematizationType = newLoadSchematizationType, calculation); }