public void Constructor_ValidArguments_ReturnExpectedValues()
        {
            // Setup
            var data = new TestIllustrationPoint();

            // Call
            var illustrationPointNode = new IllustrationPointNode(data);

            // Assert
            Assert.IsInstanceOf <ICloneable>(illustrationPointNode);
            Assert.AreSame(data, illustrationPointNode.Data);
            CollectionAssert.IsEmpty(illustrationPointNode.Children);
        }
示例#2
0
            protected override IEnumerable <IllustrationPointControlItem> GetIllustrationPointControlItems()
            {
                GeneralResult <TestTopLevelIllustrationPoint> generalResult = GetGeneralResultFunc();

                if (generalResult == null)
                {
                    return(Enumerable.Empty <IllustrationPointControlItem>());
                }

                var illustrationPoint = new TestIllustrationPoint();

                return(generalResult.TopLevelIllustrationPoints.Select(
                           p => new IllustrationPointControlItem(
                               p,
                               p.WindDirection.Name,
                               p.ClosingSituation,
                               stochasts,
                               illustrationPoint.Beta)).ToArray());
            }
示例#3
0
        public void CreateGraphNode_WithNotSupportedIllustrationPoint_ThrowsNotSupportedException()
        {
            // Setup
            var illustrationPoint = new TestIllustrationPoint();

            // Call
            void Call() =>
            RiskeerGraphNodeFactory.CreateGraphNode(illustrationPoint, new[]
            {
                CreateTestGraphNode()
            });

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

            Assert.AreEqual($"IllustrationPointNode of type {illustrationPoint.GetType().Name} is not supported. " +
                            $"Supported types: {nameof(FaultTreeIllustrationPoint)} and {nameof(SubMechanismIllustrationPoint)}",
                            exception.Message);
        }
示例#4
0
        private static void AssertIllustrationPointControlItems(GeneralResult <TestTopLevelIllustrationPoint> generalResult, IllustrationPointsControl illustrationPointsControl)
        {
            TestTopLevelIllustrationPoint topLevelFaultTreeIllustrationPoint1 = generalResult.TopLevelIllustrationPoints.ElementAt(0);
            TestTopLevelIllustrationPoint topLevelFaultTreeIllustrationPoint2 = generalResult.TopLevelIllustrationPoints.ElementAt(1);

            var illustrationPoint = new TestIllustrationPoint();

            var expectedControlItems = new[]
            {
                new IllustrationPointControlItem(topLevelFaultTreeIllustrationPoint1,
                                                 topLevelFaultTreeIllustrationPoint1.WindDirection.Name,
                                                 topLevelFaultTreeIllustrationPoint1.ClosingSituation,
                                                 stochasts,
                                                 illustrationPoint.Beta),
                new IllustrationPointControlItem(topLevelFaultTreeIllustrationPoint2,
                                                 topLevelFaultTreeIllustrationPoint2.WindDirection.Name,
                                                 topLevelFaultTreeIllustrationPoint2.ClosingSituation,
                                                 stochasts,
                                                 illustrationPoint.Beta)
            };

            CollectionAssert.AreEqual(expectedControlItems, illustrationPointsControl.Data, new IllustrationPointControlItemComparer());
        }