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 properties = new ShiftedLogNormalDistributionProperties(DistributionReadOnlyProperties.None,
                                                                        distribution,
                                                                        handler);

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

            // Assert
            Assert.AreEqual("1,00 (Standaardafwijking = 2,00, Verschuiving = 0,30)", propertyName);
        }
        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),
                Shift             = new RoundedDouble(2, 0.3)
            };

            // Call
            var properties = new ShiftedLogNormalDistributionProperties(DistributionReadOnlyProperties.None,
                                                                        distribution,
                                                                        handler);

            // Assert
            Assert.AreEqual("Lognormaal", properties.DistributionType);
            Assert.AreEqual(distribution.Mean, properties.Mean);
            Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation);
            Assert.AreEqual(distribution.Shift, properties.Shift);
        }
        public void Constructor_WithDistribution_ExpectedValues()
        {
            // Setup
            var distribution = new LogNormalDistribution();

            // Call
            var properties = new ShiftedLogNormalDistributionProperties(distribution);

            // Assert
            Assert.IsInstanceOf <DistributionPropertiesBase <LogNormalDistribution> >(properties);
            Assert.AreSame(distribution, properties.Data);
            Assert.AreEqual("Lognormaal", properties.DistributionType);

            AssertPropertiesInState(properties, true, true);
        }
        public void SingleParameterConstructor_ExpectedValues()
        {
            // Setup
            var distribution = new LogNormalDistribution();

            // Call
            var properties = new ShiftedLogNormalDistributionProperties(distribution);

            // Assert
            Assert.IsInstanceOf <LogNormalDistributionProperties>(properties);
            Assert.AreSame(distribution, properties.Data);
            Assert.AreEqual(distribution.Mean, properties.Mean);
            Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation);
            Assert.AreEqual(distribution.Shift, properties.Shift);
            Assert.AreEqual("Lognormaal", properties.DistributionType);
        }
        private static void AssertPropertiesInState(ShiftedLogNormalDistributionProperties properties, bool meanReadOnly, bool deviationReadOnly)
        {
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(4, 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.",
                                                                            meanReadOnly);

            PropertyDescriptor standardDeviationProperty = dynamicProperties[2];

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

            PropertyDescriptor shiftProperty = dynamicProperties[3];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(shiftProperty,
                                                                            "Misc",
                                                                            "Verschuiving",
                                                                            "De hoeveelheid waarmee de kansverdeling naar rechts (richting van positieve X-as) verschoven is.",
                                                                            true);
        }
        public void Constructor_WithParameters_ExpectedValues()
        {
            // Setup
            var mocks   = new MockRepository();
            var handler = mocks.Stub <IObservablePropertyChangeHandler>();

            mocks.ReplayAll();

            var distribution = new LogNormalDistribution();

            // Call
            var properties = new ShiftedLogNormalDistributionProperties(
                DistributionReadOnlyProperties.None, distribution, handler);

            // Assert
            Assert.IsInstanceOf <DistributionPropertiesBase <LogNormalDistribution> >(properties);
            Assert.AreSame(distribution, properties.Data);
            Assert.AreEqual("Lognormaal", properties.DistributionType);

            AssertPropertiesInState(properties, false, false);

            mocks.VerifyAll();
        }