Пример #1
0
        private DMT.Partition.Data.Partition CreatePartitionWithChildren(int count, Func <IEntityFactory, INode> createFunc)
        {
            var            p = new DMT.Partition.Data.Partition(new CoreEntityFactory());
            IEntityFactory f = new CoreEntityFactory();

            for (int i = 0; i < count; i++)
            {
                p.Nodes.Add(createFunc(f));
            }

            return(p);
        }
Пример #2
0
        public void GetOtherPartitionReturnsTheCorrectPartition()
        {
            var           factory = new PartitionEntityFactory();
            PartitionNode nodeA = new PartitionNode(factory);
            PartitionNode nodeB = new PartitionNode(factory);
            IPartition    p1, p2;

            nodeA.Partition = p1 = new DMT.Partition.Data.Partition(factory);;
            nodeB.Partition = p2 = new DMT.Partition.Data.Partition(factory);;

            PartitionEdge edge = new PartitionEdge(nodeA, nodeB, Core.Interfaces.EdgeDirection.Both, factory);

            nodeA.ConnectTo(nodeB, edge);

            Assert.Equal(p2, edge.GetOtherPartition(p1));
        }
Пример #3
0
        public void IsInnerReturnsTrueOnlyForInnerEdges()
        {
            var           factory   = new PartitionEntityFactory();
            IPartition    partition = new DMT.Partition.Data.Partition(factory);
            PartitionNode nodeA     = new PartitionNode(factory);
            PartitionNode nodeB     = new PartitionNode(factory);

            nodeA.Partition = partition;
            nodeB.Partition = partition;

            PartitionEdge edge = new PartitionEdge(nodeA, nodeB, Core.Interfaces.EdgeDirection.Both, factory);

            nodeA.ConnectTo(nodeB, edge);

            Assert.True(edge.IsInner);
        }