public void When_Pins_Knocked_Number_Is_Invalid_Then_ThrowError() { // Arrange Game game = new Game(); // Assert & Act Assert.Throws <ArgumentException>(() => game.Roll(-8)); }
public void When_Rolling_Ball_Then_Save_Pins_Knocked_Number() { // Arrange Game game = new Game(); // Act game.Roll(8); // Assert game.score.Should().Be(8); }
public void Test_A_Last_Strike_Score() { //Arrange var game = new Game(); var rollings = new List <int> { 1, 4, 4, 5, 6, 4, 5, 5, 10, 0, 1, 7, 3, 6, 4, 10, 10, 10, 10 }; foreach (int pins in rollings) { game.Roll(pins); } //Act var result = game.Score(); //Assert var actual = result; var expected = 157; Console.WriteLine($@"Last Strike Score: {actual}"); Assert.AreEqual(expected, actual); }
public void Test_Worst_Score() { //Arrange IGame game = new Game(); var rollings = new List <int> { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach (int pins in rollings) { game.Roll(pins); } //Act var result = game.Score(); //Assert var actual = result; var expected = 0; Console.WriteLine($@"Worst Score: {actual}"); Assert.AreEqual(expected, actual); }
public void OneRollTest(int pins) { game.Roll(pins); }
public void AddBallToScore() { game.Roll(3); Assert.AreEqual(3, game.Score); }
public void NegativePinsNotAllowed(int pins) { Action act = () => game.Roll(pins); Assert.Throws <ArgumentException>(act); }