public void GetProperties_WithData_ReturnExpectedValues() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var distribution = new NormalDistribution(2) { Mean = new RoundedDouble(2, 1), StandardDeviation = new RoundedDouble(2, 2) }; var designVariable = new NormalDistributionDesignVariable(distribution); // Call var properties = new NormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.None, designVariable, handler); // Assert Assert.AreEqual("Normaal", 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 NormalDistribution(); var designVariable = new NormalDistributionDesignVariable(distribution); // Call var properties = new NormalDistributionDesignVariableProperties(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 normale verdeling."); PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardDeviationProperty, "Misc", "Standaardafwijking", "De standaardafwijking van de normale verdeling."); PropertyDescriptor designValueProperty = dynamicProperties[3]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designValueProperty, "Misc", "Rekenwaarde", "De representatieve waarde die gebruikt wordt door de berekening.", true); mockRepository.VerifyAll(); }
public void Constructor_ExpectedValues() { // Setup var mockRepository = new MockRepository(); var handler = mockRepository.Stub <IObservablePropertyChangeHandler>(); mockRepository.ReplayAll(); var distribution = new NormalDistribution(); var designVariable = new NormalDistributionDesignVariable(distribution); // Call var properties = new NormalDistributionDesignVariableProperties(DistributionReadOnlyProperties.All, designVariable, handler); // Assert Assert.IsInstanceOf <DesignVariableProperties <NormalDistribution> >(properties); Assert.AreSame(distribution, properties.Data); Assert.AreEqual(distribution.Mean, properties.Mean); Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation); Assert.AreEqual("Normaal", properties.DistributionType); mockRepository.VerifyAll(); }