示例#1
0
            public void ShouldUpdateAllCells()
            {
                Universe universe = new Universe(CellGridFactory.FromCellStateArray(
                                                     new CellState[, ]
                {
                    { X, X, X, O },
                    { O, X, O, O },
                    { X, O, X, X },
                    { O, O, X, X }
                }));

                CellState[,] expected =
                    new CellState[, ]
                {
                    { X, X, X, O },
                    { O, O, O, X },
                    { O, O, O, X },
                    { O, X, X, X }
                };

                universe.Update();
                CellState[,] actual = universe.GetState();

                Assert.Equal(expected, actual);
            }
示例#2
0
            public void ShouldUpdateItsState()
            {
                Universe universe = new Universe(CellGridFactory.FromCellStateArray(new CellState[, ] {
                    { X }
                }));

                universe.Update();
                CellState[,] actual = universe.GetState();

                Assert.Equal(new CellState[, ] {
                    { O }
                }, actual);
            }
示例#3
0
            public void ShouldStoreItsInitialState()
            {
                CellState[,] original = new CellState[, ] {
                    { X, O, X },
                    { O, O, X },
                    { X, O, X }
                };
                Universe universe = new Universe(CellGridFactory.FromCellStateArray(original));

                CellState[,] actual = universe.GetState();

                Assert.Equal(original, actual);
            }
            public void ShouldReturnArrayOfCellsWithSameCellStates(CellState[,] initial, Cell[,] expected)
            {
                Cell[,] result = CellGridFactory.FromCellStateArray(initial);

                Assert.Equal(expected, result);
            }
            public void ShouldThrowArgumentNullExceptionWhenNullIsPassed()
            {
                Action action = () => CellGridFactory.FromCellStateArray(null);

                Assert.Throws <ArgumentNullException>(action);
            }