public void Constructor_NoGeneralResult_PropertiesHaveExpectedAttributesValues() { // Setup var structuresOutput = new StructuresOutput(0, null); // Call var properties = new StructuresOutputProperties(structuresOutput); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(2, dynamicProperties.Count); PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, resultCategoryName, "Faalkans [1/jaar]", "De kans dat het faalmechanisme optreedt voor deze berekening.", true); PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, resultCategoryName, "Betrouwbaarheidsindex faalkans [-]", "De betrouwbaarheidsindex van de faalkans voor deze berekening.", true); }
public void Constructor_ExpectedValues() { // Setup var structuresOutput = new StructuresOutput(0, null); // Call var properties = new StructuresOutputProperties(structuresOutput); // Assert Assert.IsInstanceOf <ObjectProperties <StructuresOutput> >(properties); Assert.AreSame(structuresOutput, properties.Data); }
public void IllustrationPoints_WithoutGeneralResult_ReturnsEmptyTopLevelFaultTreeIllustrationPointPropertiesArray() { // Setup var structuresOutput = new StructuresOutput(0, null); var properties = new StructuresOutputProperties(structuresOutput); // Call TopLevelFaultTreeIllustrationPointProperties[] illustrationPoints = properties.IllustrationPoints; // Assert Assert.IsEmpty(illustrationPoints); }
public void GetProperties_WithData_ReturnExpectedValues() { // Setup var generalResult = new TestGeneralResultFaultTreeIllustrationPoint(); var structuresOutput = new TestStructuresOutput(generalResult); // Call var properties = new StructuresOutputProperties(structuresOutput); // Assert Assert.AreEqual(generalResult.GoverningWindDirection.Name, properties.WindDirection); Assert.AreEqual(ProbabilityFormattingHelper.Format(0.5), properties.Probability); Assert.AreEqual(0, properties.Reliability, properties.Reliability.GetAccuracy()); TestHelper.AssertTypeConverter <StructuresOutputProperties, KeyValueExpandableArrayConverter>( nameof(StructuresOutputProperties.AlphaValues)); TestHelper.AssertTypeConverter <StructuresOutputProperties, KeyValueExpandableArrayConverter>( nameof(StructuresOutputProperties.Durations)); int nrOfExpectedStochasts = generalResult.Stochasts.Count(); Assert.AreEqual(nrOfExpectedStochasts, properties.AlphaValues.Length); Assert.AreEqual(nrOfExpectedStochasts, properties.Durations.Length); Stochast expectedStochast = generalResult.Stochasts.First(); Assert.AreEqual(expectedStochast.Alpha, properties.AlphaValues[0].Alpha); Assert.AreEqual(expectedStochast.Duration, properties.Durations[0].Duration); TestHelper.AssertTypeConverter <StructuresOutputProperties, ExpandableArrayConverter>( nameof(StructuresOutputProperties.IllustrationPoints)); int nrOfExpectedTopLevelIllustrationPoints = generalResult.TopLevelIllustrationPoints.Count(); Assert.AreEqual(nrOfExpectedTopLevelIllustrationPoints, properties.IllustrationPoints.Length); CollectionAssert.AreEqual(generalResult.TopLevelIllustrationPoints, properties.IllustrationPoints.Select(i => i.Data)); }
public void Constructor_HasGeneralResult_PropertiesHaveExpectedAttributesValues() { // Setup var generalResult = new TestGeneralResultFaultTreeIllustrationPoint(); var structuresOutput = new StructuresOutput(0, generalResult); // Call var properties = new StructuresOutputProperties(structuresOutput); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(6, dynamicProperties.Count); PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, resultCategoryName, "Faalkans [1/jaar]", "De kans dat het faalmechanisme optreedt voor deze berekening.", true); PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, resultCategoryName, "Betrouwbaarheidsindex faalkans [-]", "De betrouwbaarheidsindex van de faalkans voor deze berekening.", true); PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, illustrationPointsCategoryName, "Maatgevende windrichting", "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.", true); PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, illustrationPointsCategoryName, "Invloedscoëfficiënten [-]", "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", true); PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, illustrationPointsCategoryName, "Tijdsduren [uur]", "Tijdsduren waarop de stochasten betrekking hebben.", true); PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty, illustrationPointsCategoryName, "Illustratiepunten", "De lijst van illustratiepunten voor de berekening.", true); }