Exemplo n.º 1
0
        public void ToString_Always_ReturnDistributionName()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();
            var distribution   = mockRepository.Stub <IVariationCoefficientDistribution>();

            mockRepository.ReplayAll();

            const int numberOfDecimalPlaces = 2;

            distribution.Mean = new RoundedDouble(numberOfDecimalPlaces, 1);
            distribution.CoefficientOfVariation = new RoundedDouble(numberOfDecimalPlaces, 2);

            var designVariable = new SimpleVariationCoefficientDesignVariableProperties(distribution, new RoundedDouble(numberOfDecimalPlaces, 0.45));

            // Call
            var properties = new SimpleDesignVariableProperties(VariationCoefficientDistributionReadOnlyProperties.None,
                                                                designVariable,
                                                                handler);

            // Call
            string propertyName = properties.ToString();

            // Assert
            Assert.AreEqual("0,45 (Verwachtingswaarde = 1,00, Variatiecoëfficiënt = 2,00)", propertyName);
        }
Exemplo n.º 2
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();
            var distribution   = mockRepository.Stub <IVariationCoefficientDistribution>();

            mockRepository.ReplayAll();

            var designVariable = new SimpleVariationCoefficientDesignVariableProperties(distribution, RoundedDouble.NaN);

            // Call
            var properties = new SimpleDesignVariableProperties(VariationCoefficientDistributionReadOnlyProperties.All,
                                                                designVariable,
                                                                handler);

            // Assert
            Assert.IsInstanceOf <VariationCoefficientDistributionPropertiesBase <IVariationCoefficientDistribution> >(properties);
            Assert.AreEqual(designVariable.GetDesignValue(), properties.DesignValue);
            mockRepository.VerifyAll();
        }