Ejemplo n.º 1
0
        public async Task <SquareCounterResponse> Count()
        {
            var points = await _applicationDbContext.Points.ToListAsync();

            var squareCounterResponse = _polygonRasterizer.Rasterise(points);

            return(squareCounterResponse);
        }
Ejemplo n.º 2
0
        public void ShouldSimpleTrangleReturn4Squares()
        {
            List <Point> points = new List <Point>();

            points.Add(new Point {
                X = 0, Y = 0
            });
            points.Add(new Point {
                X = 2, Y = 4
            });
            points.Add(new Point {
                X = 4, Y = 0
            });

            var polygonRasteriser = new PolygonRasteriser();
            var countedSquares    = polygonRasteriser.Rasterise(points);

            countedSquares.Count.Should().Be(4);
        }
Ejemplo n.º 3
0
        public void Should10x10SquareHave100()
        {
            List <Point> points = new List <Point>();

            points.Add(new Point {
                X = 0, Y = 0
            });
            points.Add(new Point {
                X = 10, Y = 0
            });
            points.Add(new Point {
                X = 10, Y = 10
            });
            points.Add(new Point {
                X = 0, Y = 10
            });

            var polygonRasteriser = new PolygonRasteriser();
            var countedSquares    = polygonRasteriser.Rasterise(points);

            countedSquares.Count.Should().Be(100);
        }