public void GetPlayerBNameDefault() { // Given wrapperMock.Setup(m => m.ReadLnMessage(It.IsAny <string>())).Returns(""); IBoringToeHelper consoleHelper = new BoringToeHelper(wrapperMock.Object); // When string resp = consoleHelper.GetPlayerBName(); // Then Assert.AreEqual(resp, "Player 2", "Default returned data must be Player 2"); }
public void GetYCoordinateMustReturnMockedValue() { // Given int mockData = 1; wrapperMock.Setup(m => m.GetNumber(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>())).Returns(mockData); IBoringToeHelper consoleHelper = new BoringToeHelper(wrapperMock.Object); // When int resp = consoleHelper.GetYCoordinate(""); // Then Assert.AreEqual(resp, mockData, "Default returned data must be mocked data"); }
public void GetPlayerBNameMocked() { // Given string mockData = "TestData"; wrapperMock.Setup(m => m.ReadLnMessage(It.IsAny <string>())).Returns(mockData); IBoringToeHelper consoleHelper = new BoringToeHelper(wrapperMock.Object); // When string resp = consoleHelper.GetPlayerBName(); // Then Assert.AreEqual(resp, mockData, "Default returned data must be mocked data"); }
/// <summary> /// Entry point /// </summary> /// <param name="args"></param> static void Main(string[] args) { Program p = new Program(); p.Welcome(); try { IConsoleWrapper cwrap = new ConsoleWrapper(); IConsoleHelper chelp = new ConsoleHelper(cwrap); IBoringToeHelper bhelp = new BoringToeHelper(chelp); p.game = new BoringToe(bhelp); p.game.Run(); } catch (BgException bge) { Console.WriteLine("BoringGamesException - " + bge.Message); } catch (Exception e) { Console.WriteLine("Exception - " + e.Message); } }