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 LogNormalDistributionDesignVariableProperties(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 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 LogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None, designVariable, handler); // Assert 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."); PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardDeviationProperty, "Misc", "Standaardafwijking", "De standaardafwijking van de lognormale verdeling."); PropertyDescriptor designValueProperty = dynamicProperties[3]; 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 LogNormalDistributionDesignVariableProperties(designVariable); // Assert Assert.IsInstanceOf <DesignVariableProperties <LogNormalDistribution> >(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 LogNormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.All, designVariable, handler); // Assert Assert.IsInstanceOf <DesignVariableProperties <LogNormalDistribution> >(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(); }