public void GetSequences_gets_sequences() { // Arrange. var sut = new GameBoard(); sut.PutChip(1, 2, Team.A); sut.PutChip(1, 3, Team.A); sut.PutChip(1, 4, Team.A); sut.PutChip(1, 5, Team.A); sut.PutChip(1, 6, Team.A); // Act. var sequences = sut.GetSequences(); // Assert. Assert.That(sequences, Has.Count.EqualTo(1)); Assert.That(sequences.First().Team, Is.EqualTo(Team.A)); }
public void PutChip_sets_chip_on_coordinate() { // Arrange. const int row = 1; const int column = 1; var sut = new GameBoard(); // Act. sut.PutChip(row, column, Team.A); // Assert. Assert.That(sut.IsFree(row, column), Is.False); }
public void PutChip_throws_InvalidOperationException_when_coordinate_is_shared() { // Arrange. const int row = 0; const int column = 0; var sut = new GameBoard(); // Act. TestDelegate test = () => sut.PutChip(row, column, Team.A); // Assert. Assert.That(GameBoard.IsShared(row, column), Is.True); Assert.That(test, Throws.InvalidOperationException); }
public void PutChip_throws_ArgumentOutOfRangeException_when_team_is_not_A_or_B(Team team, bool succeeds) { // Arrange. var sut = new GameBoard(); // Act. TestDelegate test = () => sut.PutChip(1, 1, team); // Assert. if (succeeds) { Assert.That(test, Throws.Nothing); } else { Assert.That(test, Throws.TypeOf<ArgumentOutOfRangeException>()); } }
public void RemoveChip_removes_chip_from_coordinate() { // Arrange. const int row = 1; const int column = 1; var sut = new GameBoard(); sut.PutChip(row, column, Team.A); // Assume. Assume.That(sut.IsFree(row, column), Is.False); // Act. sut.RemoveChip(row, column); // Assert. Assert.That(sut.IsFree(row, column), Is.True); }