public void TestOneA(OneAInputModel input, OneAOutputModel expectedOutput)
        {
            var output = this.calculationService.CalculateOneA(input);

            Assert.Equal(expectedOutput.VertexOne.XCoordinate, output.VertexOne.XCoordinate);
            Assert.Equal(expectedOutput.VertexOne.YCoordinate, output.VertexOne.YCoordinate);
            Assert.Equal(expectedOutput.VertexTwo.XCoordinate, output.VertexTwo.XCoordinate);
            Assert.Equal(expectedOutput.VertexTwo.YCoordinate, output.VertexTwo.YCoordinate);
            Assert.Equal(expectedOutput.VertexThree.XCoordinate, output.VertexThree.XCoordinate);
            Assert.Equal(expectedOutput.VertexThree.YCoordinate, output.VertexThree.YCoordinate);
        }
        public IActionResult OneA(long column, string row)
        {
            //Create the input model from given parameters
            var inputModel = new OneAInputModel
            {
                Column = column,
                Row    = row.ToUpper()
            };

            //Check that the validation on the UI layer was not avoided
            if (!inputModel.IsValid())
            {
                return(this.BadRequest("Given data format is not valid"));
            }

            var output = this.calculationService.CalculateOneA(inputModel);

            return(this.Ok(output));
        }
        public OneAOutputModel CalculateOneA(OneAInputModel inputModel)
        {
            var outputModel = new OneAOutputModel
            {
                Input = $"{inputModel.Row}{inputModel.Column}"
            };

            var rowNumber = this.CalculateRowNumber(inputModel.Row) - 1;

            //It is known that the length of each triangle is 10 so that can be used to find the started coord
            var xCord = (long)Math.Floor((double)(inputModel.Column - 1) / 2) * this.TriangleLength;
            var yCord = rowNumber * this.TriangleLength;


            //If the column is an odd give the points as the same format as 1b
            //If the column is an even the triangle is flipped
            //V2x, V2y and V3x, V3y are always in the same position while V1x and V1y are always the right angle
            if (inputModel.Column % 2 == 0)
            {
                //State it is an even column to help with the view on the UI
                outputModel.EvenColumn = true;

                //Add the length of the triangle where necessary
                outputModel.VertexOne   = this.NewVertexModel(xCord + this.TriangleLength, yCord);
                outputModel.VertexTwo   = this.NewVertexModel(xCord, yCord);
                outputModel.VertexThree = this.NewVertexModel(xCord + this.TriangleLength, yCord + this.TriangleLength);
            }
            else
            {
                //Add the length of the triangle where necessary
                outputModel.VertexOne   = this.NewVertexModel(xCord, yCord + this.TriangleLength);
                outputModel.VertexTwo   = this.NewVertexModel(xCord, yCord);
                outputModel.VertexThree = this.NewVertexModel(xCord + this.TriangleLength, yCord + this.TriangleLength);
            }



            return(outputModel);
        }