public void Constructor_WithDistribution_ExpectedValues() { // Setup var distribution = new TruncatedNormalDistribution(new Random(21).Next(3, RoundedDouble.MaximumNumberOfDecimalPlaces)); // Call var properties = new TruncatedNormalDistributionProperties(distribution); // Assert Assert.IsInstanceOf <DistributionPropertiesBase <TruncatedNormalDistribution> >(properties); Assert.AreSame(distribution, properties.Data); Assert.AreEqual("Normaal (afgekapt)", properties.DistributionType); AssertPropertiesInState(properties, true, true); }
private static void AssertPropertiesInState(TruncatedNormalDistributionProperties properties, bool meanReadOnly, bool deviationReadOnly) { // 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 afgekapte normale verdeling.", meanReadOnly); PropertyDescriptor standardProperty = dynamicProperties[2]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardProperty, "Misc", "Standaardafwijking", "De standaardafwijking van de afgekapte normale verdeling.", deviationReadOnly); PropertyDescriptor lowerBoundaryProperty = dynamicProperties[3]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty, "Misc", "Ondergrens", "De ondergrens van de afgekapte normale verdeling.", true); PropertyDescriptor upperBoundaryProperty = dynamicProperties[4]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty, "Misc", "Bovengrens", "De bovengrens van de afgekapte normale verdeling.", true); }
public void Constructor_WithParameters_ExpectedValues() { // Setup var mocks = new MockRepository(); var handler = mocks.Stub <IObservablePropertyChangeHandler>(); mocks.ReplayAll(); var distribution = new TruncatedNormalDistribution(new Random(21).Next(3, RoundedDouble.MaximumNumberOfDecimalPlaces)); // Call var properties = new TruncatedNormalDistributionProperties(DistributionReadOnlyProperties.None, distribution, handler); // Assert Assert.IsInstanceOf <DistributionPropertiesBase <TruncatedNormalDistribution> >(properties); Assert.AreSame(distribution, properties.Data); Assert.AreEqual("Normaal (afgekapt)", properties.DistributionType); AssertPropertiesInState(properties, false, false); mocks.VerifyAll(); }