Beispiel #1
0
        public void T_GenerateArcs_SameColumn()
        {
            // Arrange
            CSP       csp = new CSP();
            GraphNode gn0 = new GraphNode(new Cell(0, 9));
            GraphNode gn1 = new GraphNode(new Cell(3, 9));
            GraphNode gn2 = new GraphNode(new Cell(9, 9));

            csp.Nodes.Add(gn0);
            csp.Nodes.Add(gn1);
            csp.Nodes.Add(gn2);

            GraphArc ga01 = new GraphArc(gn0, gn1);
            GraphArc ga02 = new GraphArc(gn0, gn2);
            GraphArc ga10 = new GraphArc(gn1, gn0);
            GraphArc ga12 = new GraphArc(gn1, gn2);
            GraphArc ga20 = new GraphArc(gn2, gn0);
            GraphArc ga21 = new GraphArc(gn2, gn1);

            // Act
            csp.GenerateArcs();

            // Assert
            CollectionAssert.AreEqual(
                gn0.ConnectedArcs,
                new List <GraphArc>(new GraphArc[] { ga01, ga02 })
                );
            CollectionAssert.AreEqual(
                gn1.ConnectedArcs,
                new List <GraphArc>(new GraphArc[] { ga10, ga12 })
                );
            CollectionAssert.AreEqual(
                gn2.ConnectedArcs,
                new List <GraphArc>(new GraphArc[] { ga20, ga21 })
                );
        }