public void Constructor_ValidData_ExpectedValues() { // Setup var random = new Random(15); const string windDirection = "N"; const string closingSituation = "closing situation"; var illustrationPoint = new SubMechanismIllustrationPoint("NNE", random.NextDouble(), Enumerable.Empty <SubMechanismIllustrationPointStochast>(), Enumerable.Empty <IllustrationPointResult>()); // Call var properties = new IllustrationPointProperties(illustrationPoint, windDirection, closingSituation); // Assert Assert.AreEqual(windDirection, properties.WindDirection); TestHelper.AssertTypeConverter <IllustrationPointProperties, NoValueRoundedDoubleConverter>( nameof(IllustrationPointProperties.Reliability)); Assert.AreEqual(illustrationPoint.Beta, properties.Reliability, properties.Reliability.GetAccuracy()); TestHelper.AssertTypeConverter <IllustrationPointProperties, NoProbabilityValueDoubleConverter>( nameof(IllustrationPointProperties.CalculatedProbability)); Assert.AreEqual(StatisticsConverter.ReliabilityToProbability(illustrationPoint.Beta), properties.CalculatedProbability); Assert.AreEqual(closingSituation, properties.ClosingSituation); }
public void IsDynamicVisible_WithOtherProperties_ReturnsFalse(string property) { // Setup var illustrationPoint = new TestFaultTreeIllustrationPoint(); var properties = new IllustrationPointProperties(illustrationPoint, "NotImportant", string.Empty); // Call bool isVisible = properties.IsDynamicVisible(property); // Assert Assert.IsFalse(isVisible); }
public void IsDynamicVisible_WithEmptyClosingSituation_ReturnsFalse() { // Setup var illustrationPoint = new TestFaultTreeIllustrationPoint(); var properties = new IllustrationPointProperties(illustrationPoint, "NotImportant", string.Empty); // Call bool isVisible = properties.IsDynamicVisible(nameof(IllustrationPointProperties.ClosingSituation)); // Assert Assert.IsFalse(isVisible); }
public void ToString_Always_ReturnIllustrationPointName() { // Setup const string name = "ImportantName"; var illustrationPoint = new TestFaultTreeIllustrationPoint(name); var properties = new IllustrationPointProperties(illustrationPoint, "NotImportant", "Closing Situation"); // Call string toString = properties.ToString(); // Assert Assert.AreEqual(name, toString); }
public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup var illustrationPointNode = new IllustrationPointNode(new TestSubMechanismIllustrationPoint()); // Call var properties = new IllustrationPointProperties(illustrationPointNode.Data, "N", "Closing Situation"); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(4, dynamicProperties.Count); PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, illustrationPointCategoryName, "Berekende kans [-]", "De berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, illustrationPointCategoryName, "Betrouwbaarheidsindex berekende kans [-]", "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, illustrationPointCategoryName, "Windrichting", "De windrichting waarvoor dit illlustratiepunt is berekend.", true); PropertyDescriptor closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty, illustrationPointCategoryName, "Keringsituatie", "De keringsituatie waarvoor dit illustratiepunt is berekend.", true); }
public void Constructor_NoClosingSituation_PropertiesHaveExpectedAttributesValues() { // Setup var illustrationPoint = new TestFaultTreeIllustrationPoint(); // Call var properties = new IllustrationPointProperties(illustrationPoint, "N", string.Empty); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(3, dynamicProperties.Count); PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, illustrationPointCategoryName, "Berekende kans [-]", "De berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty, illustrationPointCategoryName, "Betrouwbaarheidsindex berekende kans [-]", "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", true); PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty, illustrationPointCategoryName, "Windrichting", "De windrichting waarvoor dit illlustratiepunt is berekend.", true); }