Esempio n. 1
0
        public void Name_ForTopTriangleIn1GridCell_ReturnsNameWith2Suffix()
        {
            // Arrange
            var sut = new TriangleBuilder()
                      .WithIsTriangleOnBottom(false)
                      .Build();

            // Act
            var result = sut.Name;

            // Assert
            Assert.AreEqual($"{TriangleBuilder.TriangleName}2", result);
        }
Esempio n. 2
0
        public void Vertices_ExhaustiveTestForAllTrianglesIn3By3Grid(int parentCellX, int parentCellY, bool isBottom, TriangularVertex expectedVertex)
        {
            // Arrange
            var parentCell = new Mock <IGridCell>();

            parentCell.Setup(x => x.Coordinates).Returns(new Coordinates(parentCellX, parentCellY));
            parentCell.Setup(x => x.ParentGrid.Size).Returns(3);

            var sut = new TriangleBuilder()
                      .WithIsTriangleOnBottom(isBottom)
                      .WithNonHypotenuseSideLength(10)
                      .WithParentGridCell(parentCell)
                      .Build();

            // Act
            var result = sut.Vertices;

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(expectedVertex.Vertex1, result.Vertex1, "Vertex1");
            Assert.AreEqual(expectedVertex.Vertex2, result.Vertex2, "Vertex2");
            Assert.AreEqual(expectedVertex.Vertex3, result.Vertex3, "Vertex3");
        }