Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public SquareCounterService(ApplicationDbContext applicationDbContext, PolygonRasteriser polygonRasterizer)
 {
     _applicationDbContext = applicationDbContext;
     _polygonRasterizer    = polygonRasterizer;
 }