public void ExpectAllHarborsToReturnIfAdjacent() { var board = new Board(builder); var result = new List<IHarbor>(); foreach (var harbor in board.Harbors) { var player = new Mock<IPlayer>(); player.Setup(p => p.HasResources(Establishment.BUILD_RESOURCES)).Returns(true); IVertex vertex = board.Vertices.First(v => v.IsAdjacentTo(harbor.Edge)); board.BuildEstablishment(vertex, player.Object); result.AddRange(board.GetHarbors(player.Object)); } Assert.Equal(board.Harbors, result); }
public void ExpectEmptyArrayIfNoEstablismentAdjacentToHarbor() { var board = new Board(builder); var player = new Mock<IPlayer>(); var result = board.GetHarbors(player.Object); Assert.Equal(new IHarbor[] { }, result); }
public void ExpectNoResultIfEstablismentIsFromDifferentPlayer() { var board = new Board(builder); var player1 = new Mock<IPlayer>(); var player2 = new Mock<IPlayer>(); player1.Setup(p => p.HasResources(Establishment.BUILD_RESOURCES)).Returns(true); IHarbor harbor = board.Harbors.First(); IVertex vertex = board.Vertices.First(v => v.IsAdjacentTo(harbor.Edge)); board.BuildEstablishment(vertex, player1.Object); IEnumerable<IHarbor> result = board.GetHarbors(player2.Object); Assert.Equal(new IHarbor[] { }, result); }
public void CantGetHarborsForNullPlayer() { var board = new Board(builder); Assert.Throws<ArgumentNullException>(() => board.GetHarbors(null)); }