public void Test_That_When_Specified_Same_Height_And_Width_For_Rectangle_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Rectangle with width of 100 and height of 100");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_When_Specified_Radius_For_Triangle_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Triangle with a radius of 100");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_When_Not_Specified_Height_And_Width_For_Square_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a square");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_When_No_Circle_Radius_Height_Or_Width_Specified_Then_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a circle with 100");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_When_Command_Is_Empty_Then_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_Parsing_Octagon_Succeeds_When_Specifying_Side_Length()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Octagon with side of 100");

            Assert.IsTrue(response.ErrorMessages == null || !response.ErrorMessages.Any());
            Assert.AreEqual(ShapesParsingService.SupportedShapesEnum.Octagon.ToString().ToLower(), response.Data.ShapeType);
            Assert.AreEqual(8, response.Data.NumberOfAngles);
        }
Exemplo n.º 7
0
        public void Test_That_Parsing_Rectangle_Succeeds_When_Specifying_Height_And_Width()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Rectangle with height of 100 and width of 200");

            Assert.IsTrue(response.ErrorMessages == null || !response.ErrorMessages.Any());
            Assert.AreEqual(ShapesParsingService.SupportedShapesEnum.Rectangle.ToString().ToLower(), response.Data.ShapeType);
            Assert.AreEqual(100, response.Data.Height);
            Assert.AreEqual(200, response.Data.Width);
        }
        public void Test_That_When_Not_Specified_Sides_For_Octagon_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Octagon");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());

            response = service.Parse("Draw a Octagon with a height of 100 and width of 200");
            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
        public void Test_That_Parsing_Parallelogram_Succeeds_When_Specifying_Just_Width()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Parallelogram with width of 100");

            Assert.IsTrue(response.ErrorMessages == null || !response.ErrorMessages.Any());
            Assert.AreEqual(ShapesParsingService.SupportedShapesEnum.Parallelogram.ToString().ToLower(), response.Data.ShapeType);
            Assert.AreEqual(100, response.Data.Height);
            Assert.AreEqual(100, response.Data.Width);
        }
Exemplo n.º 10
0
        public void Test_Command_Parsing_Circle_Width()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a circle with width of 100");

            Assert.IsTrue(response.ErrorMessages == null || !response.ErrorMessages.Any());
            Assert.AreEqual(ShapesParsingService.SupportedShapesEnum.Circle.ToString().ToLower(), response.Data.ShapeType);
            Assert.AreEqual(100, response.Data.Height);
            Assert.AreEqual(100, response.Data.Width);
        }
        public void Test_That_When_No_Oval_Height_And_Width_Specified_Then_Validation_Fails()
        {
            IShapesParsingService service = new ShapesParsingService();
            var response = service.Parse("Draw a Oval");

            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());

            response = service.Parse("Draw a Oval with a radius of 100");
            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());

            response = service.Parse("Draw a Oval with a height of 100");
            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());

            response = service.Parse("Draw a Oval with a width of 100");
            Assert.IsTrue(response.ErrorMessages != null && response.ErrorMessages.Any());
        }
Exemplo n.º 12
0
        public Response <ShapeAttributes> Parse([FromBody] string command)
        {
            IShapesParsingService shapesParsingService = new ShapesParsingService();

            return(shapesParsingService.Parse(command));
        }