Beispiel #1
0
        public void IsAdjacentToTileWithSameXY(int x, int y, VertexTileSide side)
        {
            var tile = new Mock<ITile>();
            tile.Setup(t => t.X).Returns(x);
            tile.Setup(t => t.Y).Returns(y);

            var vertex = new Vertex(x, y, side);
            Assert.True(vertex.IsAdjacentTo(tile.Object));
        }
Beispiel #2
0
        public void IsAdjacentToTilesRightIfTileSideRight(int vertexX, int vertexY, int tileX, int tileY, bool expected)
        {
            var tile = new Mock<ITile>();
            tile.Setup(t => t.X).Returns(tileX);
            tile.Setup(t => t.Y).Returns(tileY);

            var vertex = new Vertex(vertexX, vertexY, VertexTileSide.Right);

            bool result = vertex.IsAdjacentTo(tile.Object);
            Assert.True(result == expected, $"Result: {result}, Expected: {expected}\nVertex(X: {vertexX}, Y: {vertexY}, Right); Tile(X: {tileX}, Y: {tileY}");
        }
Beispiel #3
0
        public void IsAdjacentToVertexCaseRight(int vertexX, int vertexY, int inputX, int inputY, VertexTileSide inputSide, bool expected)
        {
            var input = new Mock<IVertex>();
            input.Setup(v => v.X).Returns(inputX);
            input.Setup(v => v.Y).Returns(inputY);
            input.Setup(v => v.Side).Returns(inputSide);

            var vertex = new Vertex(vertexX, vertexY, VertexTileSide.Right);
            bool result = vertex.IsAdjacentTo(input.Object);

            Assert.True(result == expected, $"Result: {result}, Expected: {expected}\nVertext(X: {vertexX}, Y: {vertexY}, Right); Vertex(X: {inputX}, Y: {inputY}, Side: {inputSide}");
        }
Beispiel #4
0
 public void IsAdjacentToVertexNull()
 {
     var vertex = new Vertex(1, 2, VertexTileSide.Left);
     Assert.False(vertex.IsAdjacentTo((IVertex)null));
 }
Beispiel #5
0
        public void IsAdjacentTOEdgeCaseRight(int vertexX, int vertexY, int edgeX, int edgeY, EdgeSide side, bool expected)
        {
            var edge = new Mock<IEdge>();
            edge.Setup(e => e.X).Returns(edgeX);
            edge.Setup(e => e.Y).Returns(edgeY);
            edge.Setup(e => e.Side).Returns(side);

            var vertex = new Vertex(vertexX, vertexY, VertexTileSide.Right);

            bool result = vertex.IsAdjacentTo(edge.Object);

            Assert.True(result == expected, $"Result: {result}, Expected: {expected}\nVertext(X: {vertexX}, Y: {vertexY}, Right); Edge(X: {edgeX}, Y: {edgeY}, Side: {side}");

        }
Beispiel #6
0
 public void IsAdjacentToNullTile()
 {
     var vertex = new Vertex(1, 3, VertexTileSide.Left);
     Assert.False(vertex.IsAdjacentTo((ITile)null));
 }