예제 #1
0
        public void CreateWithStandardDeviation_WithParameters_CreateNewInstance()
        {
            // Setup
            var    random            = new Random(21);
            double mean              = random.NextDouble();
            double standardDeviation = random.NextDouble();
            double shift             = random.NextDouble();

            // Call
            PercentileBasedDesignVariableCalculator calculator =
                LogNormalDistributionDesignVariableCalculator.CreateWithStandardDeviation(mean, standardDeviation, shift);

            // Assert
            Assert.IsInstanceOf <LogNormalDistributionDesignVariableCalculator>(calculator);
        }
예제 #2
0
        public void DetermineDesignValue_DifferentValues_BothTypesOfCalculatorsReturnsExpectedValue(
            double mean,
            double standardDeviation,
            double shift,
            double percentile,
            double expectedValue)
        {
            // Setup
            PercentileBasedDesignVariableCalculator calculatorStd = LogNormalDistributionDesignVariableCalculator.CreateWithStandardDeviation(mean, standardDeviation, shift);
            PercentileBasedDesignVariableCalculator calculatorCov = LogNormalDistributionDesignVariableCalculator.CreateWithCoefficientOfVariation(mean, standardDeviation / (mean - shift), shift);

            // Call
            double stdDesignValue = calculatorStd.GetDesignValue(percentile);
            double covDesignValue = calculatorCov.GetDesignValue(percentile);

            // Assert
            Assert.AreEqual(expectedValue, stdDesignValue, 1e-8);
            Assert.AreEqual(expectedValue, covDesignValue, 1e-8);
        }