Ejemplo n.º 1
0
        public void GetEdges_ThrowsException_ForInvalidCell(int x, int y)
        {
            var graph = new MazeGraph(new[, ] {
                { true }
            });

            Assert.Throws <ArgumentException>(() => graph.GetEdges(new Cell(x, y)));
        }
Ejemplo n.º 2
0
        public void GetEdges_ThrowsException_ForFalseCell()
        {
            var graph = new MazeGraph(new[, ] {
                { false }
            });

            Assert.Throws <ArgumentException>(() => graph.GetEdges(new Cell(0, 0)));
        }
Ejemplo n.º 3
0
        public void GetEdges_ReturnsAllValidEdgesIn3x3_ForVertex([NotNull] string from, [NotNull] string to)
        {
            var fromVertex    = Parse(from);
            var expectedEdges = new HashSet <Edge <Cell> >();

            foreach (var vertex in ParseList(to))
            {
                expectedEdges.Add(new Edge <Cell>(fromVertex, vertex));
            }

            var graph       = new MazeGraph(_m3X3);
            var actualEdges = new HashSet <Edge <Cell> >();

            foreach (var edge in graph.GetEdges(fromVertex))
            {
                actualEdges.Add(edge);
            }

            Assert.IsTrue(expectedEdges.SetEquals(actualEdges));
        }