public void GetCommandShouldCreateEmptyCommandWhenStringIsEmpty()
 {
     IDataState data = new Data();
     INotifier notifier = new ConsoleNotifier();
     INumberGenerator numberGenerator = new RandomNumberGenerator();
     var mockedScoreboard = new Mock<IScoreboard>();
     var commandsFactory = new CommandsFactory(data, notifier, numberGenerator, mockedScoreboard.Object);
     var result = (commandsFactory.GetCommand("empty")).ToString();
     Assert.AreEqual(result, "BullsAndCows.Helpers.Commands.EmptyCommand");
 }
 public void GetCommandShouldCreateDisplayMessageCommandWhenStringIsGuessed()
 {
     IDataState data = new Data();
     data.NumberToGuess = "1234";
     INotifier notifier = new ConsoleNotifier();
     INumberGenerator numberGenerator = new RandomNumberGenerator();
     var mockedScoreboard = new Mock<IScoreboard>();
     var commandsFactory = new CommandsFactory(data, notifier, numberGenerator, mockedScoreboard.Object);
     var result = (commandsFactory.GetCommand("1234")).ToString();
     Assert.AreEqual(result, "BullsAndCows.Helpers.Commands.WinGameCommand");
 }
 public void CheatCommandExecuteShouldUpdateHasCheated()
 {
     IDataState data = new Data();
     data.NumberToGuess = "1234";
     data.CheatHelper = "XXXX";
     INotifier notifier = new ConsoleNotifier();
     INumberGenerator numberGenerator = new RandomNumberGenerator();
     CheatCommand cheatCommand = new CheatCommand(data, notifier, numberGenerator);
     cheatCommand.Execute();
     Assert.AreEqual(true, data.HasCheated);
 }
 public void WinGameCommandShouldCallScoreboardIfNotHasCheated()
 {
     INotifier notifier = new ConsoleNotifier();
     var mockedScoreboard = new Mock<IScoreboard>();
     var data = new Data();
     data.HasCheated = false;
     data.PlayTime = 7;
     data.GuessAttempts = 3;
     ICommand winGameCommand = new WinGameCommand(notifier, mockedScoreboard.Object, data);
     winGameCommand.Execute();
     mockedScoreboard.Verify(m => m.AddToScoreboard(data.GuessAttempts, data.PlayTime), Times.Once);
 }
 public void CheatCommandShouldUpdateCheatHelper()
 {
     var mockednumberGenerator = new Mock<INumberGenerator>();
     mockednumberGenerator.Setup(d => d.Next(0, 4)).Returns(1);
     IDataState data = new Data();
     data.NumberToGuess = "1234";
     data.CheatHelper = "XXXX";
     INotifier notifier = new ConsoleNotifier();
     CheatCommand cheatCommand = new CheatCommand(data, notifier, mockednumberGenerator.Object);
     cheatCommand.Execute();
     Assert.AreEqual("X2XX", data.CheatHelper);
 }