public void GetProperties_WithData_ReturnExpectedValues() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(); // Call var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // Assert Assert.AreEqual(ProbabilityFormattingHelper.Format(StatisticsConverter.ReliabilityToProbability(output.Reliability)), properties.Probability); Assert.AreEqual(output.Reliability, properties.Reliability, properties.Reliability.GetAccuracy()); GeneralResult <TopLevelFaultTreeIllustrationPoint> generalResult = output.GeneralResult; Assert.AreEqual(generalResult.GoverningWindDirection.Name, properties.WindDirection); 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); int nrOfExpectedTopLevelIllustrationPoints = generalResult.TopLevelIllustrationPoints.Count(); Assert.AreEqual(nrOfExpectedTopLevelIllustrationPoints, properties.IllustrationPoints.Length); CollectionAssert.AreEqual(generalResult.TopLevelIllustrationPoints, properties.IllustrationPoints.Select(i => i.Data)); }
public void Constructor_NoGeneralResult_PropertiesHaveExpectedAttributesValues() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(null); // Call var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // 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_WithData_ExpectedValues() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(); // Call var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // Assert Assert.IsInstanceOf <ProbabilisticFaultTreePipingOutputProperties>(properties); Assert.AreSame(output, properties.Data); }
public void IllustrationPoints_WithoutGeneralResult_ReturnsEmptyTopLevelFaultTreeIllustrationPointPropertiesArray() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(null); var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // Call TopLevelFaultTreeIllustrationPointProperties[] illustrationPoints = properties.IllustrationPoints; // Assert CollectionAssert.IsEmpty(illustrationPoints); }
public void Constructor_HasGeneralResult_PropertiesHaveExpectedAttributesValues() { // Setup PartialProbabilisticFaultTreePipingOutput output = PipingTestDataGenerator.GetRandomPartialProbabilisticFaultTreePipingOutput(); // Call var properties = new ProbabilisticFaultTreePipingOutputProperties(output); // 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]; TestHelper.AssertTypeConverter <ProbabilisticFaultTreePipingOutputProperties, KeyValueExpandableArrayConverter>( nameof(ProbabilisticFaultTreePipingOutputProperties.AlphaValues)); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, illustrationPointsCategoryName, "Invloedscoëfficiënten [-]", "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", true); PropertyDescriptor durationsProperty = dynamicProperties[durationsPropertyIndex]; TestHelper.AssertTypeConverter <ProbabilisticFaultTreePipingOutputProperties, KeyValueExpandableArrayConverter>( nameof(ProbabilisticFaultTreePipingOutputProperties.Durations)); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, illustrationPointsCategoryName, "Tijdsduren [uur]", "Tijdsduren waarop de stochasten betrekking hebben.", true); PropertyDescriptor illustrationPointProperty = dynamicProperties[illustrationPointsPropertyIndex]; TestHelper.AssertTypeConverter <ProbabilisticFaultTreePipingOutputProperties, ExpandableArrayConverter>( nameof(ProbabilisticFaultTreePipingOutputProperties.IllustrationPoints)); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty, illustrationPointsCategoryName, "Illustratiepunten", "De lijst van illustratiepunten voor de berekening.", true); }