public static void OnlyMoveToEmptySpace(int pos, int[] moves, Color c) { IBoard board = Substitute.For <IBoard>(); board.Occupant(Arg.Any <int>()).Returns(new Cow(-1, c)); IPlayer P = Substitute.For <IPlayer>(); ICowBox box = Substitute.For <ICowBox>(); box.RemainingCows(Arg.Any <Color>()).Returns(12); IReferee r = new Referee(board, box); if (c == Color.Red) { foreach (int m1 in moves) { Assert.False(r.CanMove(Color.Red, pos, m1, Phase.Moving)); } } if (c == Color.Black) { foreach (int m2 in moves) { Assert.True(r.CanMove(Color.Red, pos, m2, Phase.Moving)); } } }
public bool CanPlace(Color color, int Destination, Phase currPhase) { if (currPhase == Phase.Placing) { bool hasCows = (Box.RemainingCows(color) > 0); bool spaceIsFree = Board.Occupant(Destination).Color == Color.Black; return(hasCows && spaceIsFree); } else { return(false); } }