Ejemplo n.º 1
0
 public void should_success_if_enter_the_right_answer()
 {
     var mock = new Mock<RandomAnswerGenerator>();
     mock.Setup(m => m.KnuthShuffle(It.IsAny<int[]>())).Returns(new[]{1,2,3,4});
     var game = new GuessAgorithm(mock.Object);
     Assert.AreEqual("4B0C",game.Do("1234"));
 }
Ejemplo n.º 2
0
 public void should_throw_exception_if_enter_not_4_numbers()
 {
     var mock = new Mock<RandomAnswerGenerator>();
     mock.Setup(m => m.KnuthShuffle(It.IsAny<int[]>())).Returns(new[] { 1, 2, 3, 4 });
     var game = new GuessAgorithm(mock.Object);
     game.Do("314");
 }
Ejemplo n.º 3
0
 public void should_return_1_bulls_and_1_cows_if_enter_1628_and_right_answer_is_1234()
 {
     var mock = new Mock<RandomAnswerGenerator>();
     mock.Setup(m => m.KnuthShuffle(It.IsAny<int[]>())).Returns(new[] { 1, 2, 3, 4 });
     var game = new GuessAgorithm(mock.Object);
     Assert.AreEqual("1B1C", game.Do("1628"));
 }
Ejemplo n.º 4
0
 public GuessGame(ConsoleDisplay console, GuessAgorithm guess)
 {
     this.console = console;
     this.guess = guess;
 }