public void RevertMove_ShouldMoveBotHeadBackOnTrailOfBotTailAndMakeFieldEmpty(Color color, Move move, int expectedPositionX, int expectedPositionY) { // Arrange var initialPosition = (X : 5, Y : 10); var(board, tail) = color switch { Color.Blue => (GetValidBoard(bluePosition: initialPosition), Field.BlueTail), Color.Red => (GetValidBoard(redPosition: initialPosition), Field.RedTail), _ => throw new ArgumentOutOfRangeException(nameof(color), color, "Incorrect color provided.") }; board.SetField(expectedPositionX, expectedPositionY, tail); var competition = new Competition(board); // Act competition.RevertMove(color, move); // Assert (int X, int Y)headPosition; Field expectedHeadField; switch (color) { case Color.Blue: headPosition = competition.BluePosition; expectedHeadField = Field.BlueHead; break; case Color.Red: headPosition = competition.RedPosition; expectedHeadField = Field.RedHead; break; default: throw new ArgumentOutOfRangeException(nameof(color), color, "Incorrect color provided."); } Assert.That(headPosition, Is.EqualTo((expectedPositionX, expectedPositionY))); Assert.That(competition.GetField(expectedPositionX, expectedPositionY), Is.EqualTo(expectedHeadField)); Assert.That(competition.GetField(initialPosition.X, initialPosition.Y), Is.EqualTo(Field.Empty)); }
public void GetField_ShouldReturnFieldFromTheBoard() { // Arrange var board = GetValidBoard(); var competition = new Competition(board); // Act // Assert for (var x = 0; x < 10; x++) { for (var y = 0; y < 20; y++) { Assert.That(competition.GetField(x, y), Is.EqualTo(board.GetField(x, y))); } } }