Exemple #1
0
        public void SetStochasts_WithAllStochastsSet_SetExpectedValuesOnInput()
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name")
            {
                StructureId         = "some structure",
                LevelCrestStructure = new StochastConfiguration
                {
                    Mean = 1.1,
                    StandardDeviation = 1.5
                },
                AllowedLevelIncreaseStorage = new StochastConfiguration
                {
                    Mean = 2.1,
                    StandardDeviation = 2.5
                },
                FlowWidthAtBottomProtection = new StochastConfiguration
                {
                    Mean = 3.1,
                    StandardDeviation = 3.5
                },
                WidthFlowApertures = new StochastConfiguration
                {
                    Mean = 4.1,
                    StandardDeviation = 4.5
                },
                ModelFactorSuperCriticalFlow = new StochastConfiguration
                {
                    Mean = 5.1
                },
                CriticalOvertoppingDischarge = new StochastConfiguration
                {
                    Mean = 6.1,
                    VariationCoefficient = 0.6
                },
                StorageStructureArea = new StochastConfiguration
                {
                    Mean = 7.1,
                    VariationCoefficient = 0.7
                },
                StormDuration = new StochastConfiguration
                {
                    Mean = 8.1
                }
            };

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Call
            bool valid = assigner.Assign();

            // Assert
            Assert.IsTrue(valid);
        }
Exemple #2
0
        public void Constructor_WithParameters_ReturnsNewInstance()
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name");
            var calculation   = new StructuresCalculation <HeightStructuresInput>();

            // Call
            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Assert
            Assert.IsInstanceOf <StructuresCalculationStochastAssigner <
                                     HeightStructuresCalculationConfiguration,
                                     HeightStructuresInput, HeightStructure> >(assigner);
        }
Exemple #3
0
        public void Assign_WithoutStructureParametersDefinedForStructureDependentStochast_ReturnsFalse(
            Action <HeightStructuresCalculationConfiguration> modify)
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name");

            modify(configuration);

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            // Call
            bool valid = assigner.Assign();

            // Assert
            Assert.IsFalse(valid);
        }
Exemple #4
0
        public void Assign_WithSpreadForModelFactorSuperCriticalFlow_LogsErrorReturnFalse(bool withStandardDeviation)
        {
            // Setup
            var configuration = new HeightStructuresCalculationConfiguration("name")
            {
                StructureId = "some structure",
                ModelFactorSuperCriticalFlow = new StochastConfiguration
                {
                    Mean = 8.1
                }
            };

            if (withStandardDeviation)
            {
                configuration.ModelFactorSuperCriticalFlow.StandardDeviation = 0.8;
            }
            else
            {
                configuration.ModelFactorSuperCriticalFlow.VariationCoefficient = 0.8;
            }

            var calculation = new StructuresCalculation <HeightStructuresInput>();

            var assigner = new HeightStructuresCalculationStochastAssigner(
                configuration,
                calculation);

            var valid = true;

            // Call
            Action test = () => valid = assigner.Assign();

            // Assert
            const string expectedMessage = "Er kan geen spreiding voor stochast 'modelfactoroverloopdebiet' opgegeven worden. Berekening 'name' is overgeslagen.";

            TestHelper.AssertLogMessageWithLevelIsGenerated(test, Tuple.Create(expectedMessage, LogLevelConstant.Error));
            Assert.IsFalse(valid);
        }