Пример #1
0
        private bool IsSomeErrors(HangManModel model)
        {
            bool result = false;

            if (!String.IsNullOrEmpty(model.Errors))
            {
                Console.WriteLine($"Something went wrong... : {model.Errors}");
                result = true;
            }
            return(result);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 public HangManServiceTest()
 {
     _service = new HangManService();
     _service.SetSecret(_secretValue);
     _modelInit = new HangManModel()
     {
         EnteredChars  = new List <char>(),
         HangManStatus = HangManStatus.Clear,
         PlayerStatus  = PlayerStatus.Playing,
         AnswearChars  = new char[] { '_', '_', '_', '_', '_', '_', '_', '_', '_' }
     };
 }
Пример #5
0
        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;
            }
        }
Пример #6
0
 private void ConsoleDrawData(HangManModel model)
 {
     Console.WriteLine($"Secret Phrase: {string.Join(" ", model.AnswearChars)}");
     Console.WriteLine($"Your letters : {string.Join(" ", model.EnteredChars)}");
 }