private bool IsSomeErrors(HangManModel model) { bool result = false; if (!String.IsNullOrEmpty(model.Errors)) { Console.WriteLine($"Something went wrong... : {model.Errors}"); result = true; } return(result); }
public void NextStep_CallingForWin() { char[] enteredChars = new char[] { 's', 'o', 'm', 'e', 't', 'x', 't' }; HangManModel model = new HangManModel(); foreach (char item in enteredChars) { model = _service.NextStep(item); } Assert.AreEqual(PlayerStatus.Win, model.PlayerStatus); }
public void NextStep_CallingForLose() { char[] enteredChars = new char[] { 'z', 'z', 'z', 'z', 'z', 'z', 'z', 'z' }; HangManModel model = new HangManModel(); foreach (char item in enteredChars) { model = _service.NextStep(item); } Assert.AreEqual(HangManStatus.TwoLegs, model.HangManStatus); Assert.AreEqual(PlayerStatus.Lose, model.PlayerStatus); }
public HangManServiceTest() { _service = new HangManService(); _service.SetSecret(_secretValue); _modelInit = new HangManModel() { EnteredChars = new List <char>(), HangManStatus = HangManStatus.Clear, PlayerStatus = PlayerStatus.Playing, AnswearChars = new char[] { '_', '_', '_', '_', '_', '_', '_', '_', '_' } }; }
private void ConsoleDrawResult(HangManModel model) { switch (model.PlayerStatus) { case PlayerStatus.Lose: Console.WriteLine("YOU LOSE"); break; case PlayerStatus.Win: Console.WriteLine("YOU WIN"); break; default: break; } }
private void ConsoleDrawData(HangManModel model) { Console.WriteLine($"Secret Phrase: {string.Join(" ", model.AnswearChars)}"); Console.WriteLine($"Your letters : {string.Join(" ", model.EnteredChars)}"); }