Example #1
0
        public void TestGetTriangleByCoords()
        {
            var controller = new TrianglesController();
            var result     = controller.GetTriangleByCoords(60, 50, 50, 50, 60, 60);

            Assert.AreEqual(result, "F12");
        }
Example #2
0
        public void TestGetTriangleByCoordsOdd()
        {
            var controller = new TrianglesController();
            var result     = controller.GetTriangleByCoords(20, 40, 20, 30, 30, 40);

            Assert.AreEqual(result, "D5");
        }
Example #3
0
        public void GetByVertices(string input, string expected)
        {
            // Arrange
            TrianglesController controller = new TrianglesController();

            // Act
            string result = controller.Vertices(input);

            // Assert
            Assert.AreEqual(expected, result, input);
        }
Example #4
0
        public void Get()
        {
            // Arrange
            TrianglesController controller = new TrianglesController();

            // Act
            IEnumerable <string> result = controller.Get();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(72, result.Count());
            Assert.AreEqual("{\"Row\":1,\"Col\":1,\"Location\":\"A1\",\"Vertices\":[\"0, 0\",\"10, 10\",\"0, 10\"]}", result.ElementAt(0));
        }
Example #5
0
        public void TestGetTriangleCoordinatesByRowAndColumnEven()
        {
            var controller = new TrianglesController();

            var result = controller.GetCoordinates("D", 6);

            Assert.AreEqual(result.V1x, 30);
            Assert.AreEqual(result.V1y, 30);
            Assert.AreEqual(result.V2x, 20);
            Assert.AreEqual(result.V2y, 30);
            Assert.AreEqual(result.V3x, 30);
            Assert.AreEqual(result.V3y, 40);
        }
Example #6
0
        public TrianglesControllerTest()
        {
            Mock <ILogger <TrianglesController> > mockLogger = new Mock <ILogger <TrianglesController> >();

            _triangleController = new TrianglesController(_mockTriangleService.Object, mockLogger.Object);
        }
Example #7
0
 public TrianglesControllerTests()
 {
     _controller = new TrianglesController();
 }
Example #8
0
 public void Setup()
 {
     trianglesController = new TrianglesController(new TriangleResolver());
 }