public void VerticalWins() { var boardState = new Dictionary <Cell, Color>(); boardState[Cell(1, 1)] = Color.Red; boardState[Cell(1, 2)] = Color.Red; boardState[Cell(1, 3)] = Color.Red; boardState[Cell(1, 4)] = Color.Red; boardState[Cell(2, 1)] = Color.Yellow; boardState[Cell(2, 2)] = Color.Yellow; boardState[Cell(2, 3)] = Color.Yellow; TestReferee.Horizontal(boardState, Cell(1, 1)); TestReferee.Horizontal(boardState, Cell(1, 2)); TestReferee.Horizontal(boardState, Cell(1, 3)); TestReferee.Horizontal(boardState, Cell(1, 4)); }
public void HorizontalWins() { var boardState = new Dictionary <Cell, Color>(); boardState[Cell(1, 1)] = Color.Red; boardState[Cell(2, 1)] = Color.Red; boardState[Cell(3, 1)] = Color.Red; boardState[Cell(4, 1)] = Color.Red; boardState[Cell(1, 2)] = Color.Yellow; boardState[Cell(2, 2)] = Color.Yellow; boardState[Cell(3, 2)] = Color.Yellow; // Sending different Cells for it to test against forces the verification to assume // that particular last move. So rather than just checking from one end to the other, // it takes the move played and looks to the left and then to the right (if necessary) TestReferee.Horizontal(boardState, Cell(1, 1)); TestReferee.Horizontal(boardState, Cell(2, 1)); TestReferee.Horizontal(boardState, Cell(3, 1)); TestReferee.Horizontal(boardState, Cell(4, 1)); }
private void Diagonal1() { var boardState = new Dictionary <Cell, Color>(); boardState.Add(Cell(1, 1), Color.Yellow); boardState.Add(Cell(2, 1), Color.Yellow); boardState.Add(Cell(3, 1), Color.Yellow); boardState.Add(Cell(1, 2), Color.Yellow); boardState.Add(Cell(2, 2), Color.Yellow); boardState.Add(Cell(1, 3), Color.Yellow); boardState.Add(Cell(1, 4), Color.Red); boardState.Add(Cell(2, 3), Color.Red); boardState.Add(Cell(3, 2), Color.Red); boardState.Add(Cell(4, 1), Color.Red); TestReferee.Draw(boardState); Assert.True(TestReferee.Diagonal(boardState, Cell(1, 4))); Assert.True(TestReferee.Diagonal(boardState, Cell(2, 3))); Assert.True(TestReferee.Diagonal(boardState, Cell(3, 2))); Assert.True(TestReferee.Diagonal(boardState, Cell(4, 1))); }
private void Diagonal8() { var boardState = new Dictionary <Cell, Color>(); boardState.Add(Cell(5, 1), Color.Yellow); boardState.Add(Cell(6, 1), Color.Yellow); boardState.Add(Cell(6, 2), Color.Yellow); boardState.Add(Cell(7, 1), Color.Yellow); boardState.Add(Cell(7, 2), Color.Yellow); boardState.Add(Cell(7, 3), Color.Yellow); boardState.Add(Cell(1, 3), Color.Red); boardState.Add(Cell(2, 4), Color.Red); boardState.Add(Cell(3, 5), Color.Red); boardState.Add(Cell(4, 6), Color.Red); TestReferee.Draw(boardState); Assert.True(TestReferee.Diagonal(boardState, Cell(1, 3))); Assert.True(TestReferee.Diagonal(boardState, Cell(2, 4))); Assert.True(TestReferee.Diagonal(boardState, Cell(3, 5))); Assert.True(TestReferee.Diagonal(boardState, Cell(4, 6))); }