public void TestGridGameOverShouldDisplay() { this.testStr = string.Empty; var i = 0; this.keysCnt = 0; this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); var view = new ConsoleView(true, this.ConsoleMock()); view.AddPlayerEvent += (sender, args) => { }; view.DisplayGameOver(true); Assert.AreEqual(this.testStr != string.Empty, true, "No output!"); this.testStr = string.Empty; i = 0; this.keysCnt = 0; this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); view = new ConsoleView(true, this.ConsoleMock()); view.AddPlayerEvent += (sender, args) => { }; view.DisplayGameOver(false); Assert.AreEqual(this.testStr != string.Empty, true, "No output!"); }
public void TestGridShouldDisplay() { this.testStr = string.Empty; var i = 0; this.keysCnt = 0; this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.End, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); var view = new ConsoleView(true, this.ConsoleMock()); var grid = MinesweeperGridFactory.CreateNewTable(MinesweeperDifficultyType.Easy); grid.BoomEvent += (sender, args) => { }; grid.ProtectCell(0, 0); grid.RevealCell(1, 1); view.DisplayGrid(grid); i = 0; grid.RevealAllMines(); view.DisplayGrid(grid); Assert.AreEqual(this.testStr != string.Empty, true, "No output!"); }
public void TestViewDisplayMovesAndTimeShouldNotDisplayInNotRealView() { this.testStr = string.Empty; var view = new ConsoleView(false, this.ConsoleMock()); view.DisplayTime(0); view.DisplayMoves(0); Assert.AreEqual(this.testStr == string.Empty, true, "No output!"); }
public void TestViewPlayersShouldDisplay() { this.testStr = string.Empty; var i = 0; this.keysCnt = 0; this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.Enter, false, false, false); this.testKeys[i++] = new ConsoleKeyInfo(' ', ConsoleKey.E, false, false, false); var view = new ConsoleView(true, this.ConsoleMock()); var board = new List<MinesweeperPlayer> { new MinesweeperPlayer { Name = "test", Time = 0, Type = MinesweeperDifficultyType.Easy } }; view.DisplayScoreBoard(board); Assert.AreEqual(this.testStr != string.Empty, true, "No output!"); }
public void TestScoreList() { var view = new ConsoleView(true, this.ConsoleMock()); view.ShowScoreBoardEvent += (sender, args) => { }; view.RequestScoreList(MinesweeperDifficultyType.Easy); }