Beispiel #1
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var registry = new StabilityPointStructuresValidationRulesRegistry();

            // Assert
            Assert.IsInstanceOf <IStructuresValidationRulesRegistry <StabilityPointStructuresInput, StabilityPointStructure> >(registry);
        }
Beispiel #2
0
        public void GetValidationRules_InputNull_ThrowsArgumentNullException()
        {
            // Setup
            var registry = new StabilityPointStructuresValidationRulesRegistry();

            // Call
            TestDelegate test = () => registry.GetValidationRules(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(test);

            Assert.AreEqual("input", exception.ParamName);
        }
Beispiel #3
0
        public void GetValidationRules_InvalidInflowModelType_ThrowsInvalidEnumArgumentException()
        {
            // Setup
            var registry = new StabilityPointStructuresValidationRulesRegistry();

            // Call
            TestDelegate test = () => registry.GetValidationRules(new StabilityPointStructuresInput
            {
                InflowModelType = (StabilityPointStructureInflowModelType)99
            });

            // Assert
            const string message = "The value of argument 'input' (99) is invalid for Enum type 'StabilityPointStructureInflowModelType'.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(test, message);
        }
Beispiel #4
0
        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]);
        }