public void GetProperties_WithData_ReturnExpectedValues()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var distribution = new LogNormalDistribution(2)
            {
                Mean = new RoundedDouble(2, 1),
                StandardDeviation = new RoundedDouble(2, 2)
            };
            var designVariable = new LogNormalDistributionDesignVariable(distribution);

            // Call
            var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None,
                                                                                      designVariable,
                                                                                      handler);

            // Assert
            Assert.AreEqual("Lognormaal", properties.DistributionType);
            Assert.AreEqual(distribution.Mean, properties.Mean);
            Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation);
            Assert.AreEqual(designVariable.GetDesignValue(), properties.DesignValue);
        }
        public void ToString_Always_ReturnDistributionName()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var distribution = new LogNormalDistribution(2)
            {
                Mean = new RoundedDouble(2, 1),
                StandardDeviation = new RoundedDouble(2, 2),
                Shift             = new RoundedDouble(2, 0.3)
            };
            var designVariable = new LogNormalDistributionDesignVariable(distribution);

            // Call
            var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None,
                                                                                      designVariable,
                                                                                      handler);

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

            // Assert
            Assert.AreEqual("0,53 (Verwachtingswaarde = 1,00, Standaardafwijking = 2,00, Verschuiving = 0,30)", propertyName);
        }
        public void Constructor_Always_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var distribution   = new LogNormalDistribution();
            var designVariable = new LogNormalDistributionDesignVariable(distribution);

            // Call
            var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None,
                                                                                      designVariable,
                                                                                      handler);

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(5, dynamicProperties.Count);

            PropertyDescriptor distributionTypeProperty = dynamicProperties[0];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(distributionTypeProperty,
                                                                            "Misc",
                                                                            "Type verdeling",
                                                                            "Het soort kansverdeling waarin deze parameter gedefinieerd wordt.",
                                                                            true);

            PropertyDescriptor meanProperty = dynamicProperties[1];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(meanProperty,
                                                                            "Misc",
                                                                            "Verwachtingswaarde",
                                                                            "De gemiddelde waarde van de lognormale verdeling.");

            PropertyDescriptor standardDeviationProperty = dynamicProperties[2];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardDeviationProperty,
                                                                            "Misc",
                                                                            "Standaardafwijking",
                                                                            "De standaardafwijking van de lognormale verdeling.");

            PropertyDescriptor shiftProperty = dynamicProperties[3];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(shiftProperty,
                                                                            "Misc",
                                                                            "Verschuiving",
                                                                            "De hoeveelheid waarmee de kansverdeling naar rechts (richting van positieve X-as) verschoven is.",
                                                                            true);

            PropertyDescriptor designValueProperty = dynamicProperties[4];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designValueProperty,
                                                                            "Misc",
                                                                            "Rekenwaarde",
                                                                            "De representatieve waarde die gebruikt wordt door de berekening.",
                                                                            true);
            mockRepository.VerifyAll();
        }
        public void SingleParameterConstructor_ExpectedValues()
        {
            // Setup
            var distribution   = new LogNormalDistribution();
            var designVariable = new LogNormalDistributionDesignVariable(distribution);

            // Call
            var properties = new ShiftedLogNormalDistributionDesignVariableProperties(designVariable);

            // Assert
            Assert.IsInstanceOf <LogNormalDistributionDesignVariableProperties>(properties);
            Assert.AreSame(distribution, properties.Data);
            Assert.AreEqual(distribution.Mean, properties.Mean);
            Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation);
            Assert.AreEqual("Lognormaal", properties.DistributionType);
        }
        public void Constructor_ExpectedValues()
        {
            // Setup
            var mockRepository = new MockRepository();
            var handler        = mockRepository.Stub <IObservablePropertyChangeHandler>();

            mockRepository.ReplayAll();

            var distribution   = new LogNormalDistribution();
            var designVariable = new LogNormalDistributionDesignVariable(distribution);

            // Call
            var properties = new ShiftedLogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.All,
                                                                                      designVariable,
                                                                                      handler);

            // Assert
            Assert.IsInstanceOf <LogNormalDistributionDesignVariableProperties>(properties);
            Assert.AreSame(distribution, properties.Data);
            Assert.AreEqual(distribution.Mean, properties.Mean);
            Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation);
            Assert.AreEqual("Lognormaal", properties.DistributionType);
            mockRepository.VerifyAll();
        }