public void CommandWithProperInvalidBoardShouldThrow() { var cmd = new PopBalloonCommand(); var ctx = new CommandContext(new Logger(), null, 2, 2, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); cmd.Execute(ctx); }
public void OnExecuteShouldInformPlayerThatAMementoIsNotAvailableWhenThereIsntOneSaved() { var ctx = new CommandContext(new Logger(), new Board(5, 5, new RandomGenerator()), 2, 2, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); var cmd = new UndoCommand(); cmd.Execute(ctx); var expected = ctx.Messages["invalidsave"]; Assert.AreEqual(expected, ctx.CurrentMessage); }
public void CommandContextShouldCreateProperly() { var ctx = new CommandContext(new Logger(), new Board(5, 5, this.randomGenerator), 4, 4, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); }
public void CommandContextPropertiesAreAccessible() { var ctx = new CommandContext(new Logger(), new Board(5, 5, this.randomGenerator), 4, 4, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); Assert.IsTrue(ctx.Logger != null && ctx.Board != null && ctx.Memory != null && ctx.Score != null); }
public void CommandContextMessagesShouldContainWelcomeAndGoodbyeMessages() { var ctx = new CommandContext(new Logger(), new Board(5, 5, this.randomGenerator), 4, 4, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); Assert.IsTrue(ctx.Messages.ContainsKey("welcome") && ctx.Messages.ContainsKey("goodbye")); }
public void CommandContextMessagesShouldContainOneOrMoreEntries() { var ctx = new CommandContext(new Logger(), new Board(5, 5, this.randomGenerator), 4, 4, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); Assert.IsTrue(ctx.Messages.Count > 0); }
public void CommandContextCurrentMessageShouldBeSetInitially() { var ctx = new CommandContext(new Logger(), new Board(5, 5, this.randomGenerator), 4, 4, new BoardMemory(), Highscore.GetInstance(), new HighscoreProcessor()); Assert.IsTrue(ctx.CurrentMessage == ctx.Messages["welcome"]); }