示例#1
0
        public void Grid_GetValidColours_ReturnsArrayOfValidColours()
        {
            /*
             *              RED
             *      BLUE    CELL (1,1)    YELLOW
             *              GREEN
             */
            var grid = new Grid(3);
            grid.SetCell(new Cell(ColourEnum.None, ColourEnum.None, ColourEnum.Blue, ColourEnum.None), 0, 1); // l
            grid.SetCell(new Cell(ColourEnum.None, ColourEnum.None, ColourEnum.None, ColourEnum.Red), 1, 2); // t
            grid.SetCell(new Cell(ColourEnum.Yellow, ColourEnum.None, ColourEnum.None, ColourEnum.None), 2, 1); // r
            grid.SetCell(new Cell(ColourEnum.None, ColourEnum.Green, ColourEnum.None, ColourEnum.None), 1, 0); // b

            var result = grid.GetValidColours(1, 1);

            Assert.IsTrue(result.SequenceEqual(new List<ColourEnum> { ColourEnum.Blue, ColourEnum.Red, ColourEnum.Yellow, ColourEnum.Green }));
        }