Esempio n. 1
0
        public void CanFillGridRandomly()
        {
            var service = new GridService(new RandomService());
            var grid    = service.CreateNew(new List <GridCell>(), new Size(3, 3), 0);

            foreach (var index in Enumerable.Range(0, grid.Size.Width * grid.Size.Height))
            {
                service.AddRandomCell(grid);
            }

            foreach (var row in Enumerable.Range(0, grid.Size.Height))
            {
                foreach (var column in Enumerable.Range(0, grid.Size.Width))
                {
                    grid.TryGetCell(column, row)
                    .Should()
                    .NotBeNull();
                }
            }
        }