public void IsDynamicVisible_WithOtherProperties_ReturnsFalse(string property)
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var properties        = new FaultTreeIllustrationPointProperties(illustrationPoint, new IllustrationPointNode[0], "N", string.Empty);

            // Call
            bool isVisible = properties.IsDynamicVisible(property);

            // Assert
            Assert.IsFalse(isVisible);
        }
        public void IsDynamicVisible_WithoutChildren_ReturnsFalse()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var properties        = new FaultTreeIllustrationPointProperties(illustrationPoint, new IllustrationPointNode[0], "N", "Regular");

            // Call
            bool isVisible = properties.IsDynamicVisible(nameof(properties.IllustrationPoints));

            // Assert
            Assert.IsFalse(isVisible);
        }
        public void IsDynamicVisible_WithEmptyClosingSituation_ReturnsFalse()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var properties        = new FaultTreeIllustrationPointProperties(illustrationPoint, new IllustrationPointNode[0], "N", string.Empty);

            // Call
            bool isVisible = properties.IsDynamicVisible(nameof(IllustrationPointProperties.ClosingSituation));

            // Assert
            Assert.IsFalse(isVisible);
        }
Example #4
0
        public void CreateGraphNode_WithFaultTreeIllustrationPointButChildrenNull_ThrowsArgumentNullException()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();

            // Call
            void Call() => RiskeerGraphNodeFactory.CreateGraphNode(illustrationPoint, null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("childNodes", exception.ParamName);
        }
        public void IsDynamicVisible_WithClosingSituation_ReturnsTrue()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var properties        = new IllustrationPointProperties(illustrationPoint,
                                                                    "NotImportant",
                                                                    "Closing Situation");

            // Call
            bool isVisible = properties.IsDynamicVisible(nameof(IllustrationPointProperties.ClosingSituation));

            // Assert
            Assert.IsTrue(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);
        }
Example #7
0
        public void CreateInstance_ValidArguments_ReturnFaultTreeIllustrationPointBaseProperties()
        {
            // Setup
            var illustrationPoint     = new TestFaultTreeIllustrationPoint();
            var illustrationPointNode = new IllustrationPointNode(illustrationPoint);
            var context = new IllustrationPointContext <FaultTreeIllustrationPoint>(illustrationPoint, illustrationPointNode,
                                                                                    "Wind direction", "Closing situation");

            // Call
            IObjectProperties objectProperties = info.CreateInstance(context);

            // Assert
            Assert.IsInstanceOf <FaultTreeIllustrationPointProperties>(objectProperties);
            Assert.AreSame(illustrationPoint, objectProperties.Data);
        }
        public void IsDynamicVisible_WithChildren_ReturnsTrue()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var childNodes        = new[]
            {
                new IllustrationPointNode(new TestSubMechanismIllustrationPoint("A")),
                new IllustrationPointNode(new TestSubMechanismIllustrationPoint("B"))
            };
            var properties = new FaultTreeIllustrationPointProperties(illustrationPoint, childNodes, "N", "Regular");

            // Call
            bool isVisible = properties.IsDynamicVisible(nameof(properties.IllustrationPoints));

            // Assert
            Assert.IsTrue(isVisible);
        }
Example #9
0
        public void GetStochastNames_FaultTreeIllustrationPointWithStochast_ReturnsExpectedName()
        {
            // Setup
            var          random        = new Random(21);
            const string stochastNameA = "Stochast A";
            const string stochastNameB = "Stochast B";
            var          faultTreeIllustrationPoint = new TestFaultTreeIllustrationPoint(new[]
            {
                new Stochast(stochastNameA, random.NextDouble(), random.NextDouble()),
                new Stochast(stochastNameB, random.NextDouble(), random.NextDouble())
            });

            // Call
            IEnumerable <string> names = faultTreeIllustrationPoint.GetStochastNames();

            // Assert
            CollectionAssert.AreEqual(new[]
            {
                stochastNameA,
                stochastNameB
            }, names);
        }
        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);
        }
        public void VisibleProperties_WithChildIllustrationPointNodes_ExpectedAttributesValues()
        {
            // Setup
            var illustrationPoint = new TestFaultTreeIllustrationPoint();
            var childNodes        = new[]
            {
                new IllustrationPointNode(new TestSubMechanismIllustrationPoint("A")),
                new IllustrationPointNode(new TestSubMechanismIllustrationPoint("B"))
            };

            // Call
            var properties = new FaultTreeIllustrationPointProperties(illustrationPoint, childNodes, "N", "Regular");

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(7, dynamicProperties.Count);

            const string       illustrationPointsCategoryName = "Illustratiepunten";
            PropertyDescriptor probabilityProperty            = dynamicProperties[probabilityPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty,
                                                                            illustrationPointsCategoryName,
                                                                            "Berekende kans [-]",
                                                                            "De berekende kans van voorkomen van het berekende resultaat.",
                                                                            true);

            PropertyDescriptor reliabilityProperty = dynamicProperties[reliabilityPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(reliabilityProperty,
                                                                            illustrationPointsCategoryName,
                                                                            "Betrouwbaarheidsindex berekende kans [-]",
                                                                            "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.",
                                                                            true);

            PropertyDescriptor windDirectionProperty = dynamicProperties[windDirectionPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(windDirectionProperty,
                                                                            illustrationPointsCategoryName,
                                                                            "Windrichting",
                                                                            "De windrichting waarvoor dit illlustratiepunt is berekend.",
                                                                            true);

            PropertyDescriptor closingScenarioProperty = dynamicProperties[closingScenarioPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(closingScenarioProperty,
                                                                            illustrationPointsCategoryName,
                                                                            "Keringsituatie",
                                                                            "De keringsituatie waarvoor dit illustratiepunt is berekend.",
                                                                            true);

            PropertyDescriptor alphasProperty = dynamicProperties[alphasPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphasProperty,
                                                                            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[illustrationPointPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointProperty,
                                                                            illustrationPointsCategoryName,
                                                                            "Illustratiepunten",
                                                                            "De lijst van illustratiepunten voor de berekening.",
                                                                            true);
        }