public void Should_create_BullsAndCowsGame() { var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); Assert.NotNull(game); Assert.True(game.CanContinue); }
public void Should_return_wrong_input_tip_when_digits_not_separated_by_space(string guess) { var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); string answer = game.Guess(guess); Assert.Equal("Wrong Input, input again", answer); }
public void Should_return_0A0B_when_all_wrong() { //given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); //when string answerWithMessage = game.Guess("5 6 7 8"); //then Assert.Equal("0A0B", answerWithMessage.Split(" ")[0]); }
public void Should_Return_0A4B_when_all_digit_correct_all_position_wrong(string guess) { //given var testSecretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(testSecretGenerator); //when string answer = game.Guess(guess); //then Assert.Equal("0A4B", answer); }
public void Should_return_0A4B_when_no_digital_right_and__all_positions_wrong() { //var secretGenerator = new SecretGenerator(); var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); //when string answer = game.Guess("8 7 6 5"); //then Assert.Equal("0A4B", answer); }
public void Should_return_0A4B_when_digit_wrong_and_position_right(string guess) { // given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); // when var answer = game.Guess(guess); // then Assert.Equal("0A4B", answer); }
public void Should_return_0A0B_when_all_digit_and_position_wrong() { // given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); // when var answer = game.Guess("5 6 7 8"); // then Assert.Equal("0A0B", answer); }
public void Should_return_1A2B_given_secret_1234_guess_1425() { //given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); var expect = "1A2B"; //when var actual = game.Guess("1 4 2 5"); //then Assert.Equal(expect, actual); }
public void Should_return_0A4B_given_secret_1234_guess_4321_and_3421(string guess) { //given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); var expect = "0A4B"; //when var actual = game.Guess(guess); //then Assert.Equal(expect, actual); }
public void Should_Guess_return_0A0B_when_all_digit_position_Wrong(string guess) { // given var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); // when string answer = game.Guess(guess); // then Assert.Equal("0A0B", answer); }
public void ShouldReturn0A4BGivenAllDigitCorrectAndAllPositionWrong(string guess) { // given // var secretGenerator = new SecretGenerator(); var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); // when string answer = game.Guess(guess); // then Assert.Equal("0A4B", answer); }
public void ShouldReturn4A0BGivenAllDigitAndRightPosition() { // given // var secretGenerator = new SecretGenerator(); var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); // when string answer = game.Guess("1 2 3 4"); // then Assert.Equal("4A0B", answer); }
public void Should_terminate_game_after_6_guesses() { var secretGenerator = new TestSecretGenerator(); var game = new BullsAndCowsGame(secretGenerator); for (int i = 0; i < 5; i++) { game.Guess("5 2 3 4"); } Assert.True(game.CanContinue); game.Guess("5 2 3 4"); Assert.False(game.CanContinue); }