Exemplo n.º 1
0
        internal async Task Play(List <IPlayer> a_playerList, model.task.delay.IAsyncDelay a_asyncDelay, bool a_noTest = true)
        {
            do
            {
                foreach (IPlayer player in a_playerList)
                {
                    m_IView.DisplayGameKeys();
                    m_IView.DisplayRolledDices(player.GetPlayername(), player.GetHand(), player.CalculateScore(), player.GetTotalScore());
                    var action = m_IView.PlayerAction();

                    if (action == view.FarkleView.Action.NewGame)
                    {
                        NewGame(a_noTest);
                    }

                    if (action == view.FarkleView.Action.Roll)
                    {
                        await Roll(player, a_noTest, a_asyncDelay);

                        continue;
                    }

                    if (action == view.FarkleView.Action.Save)
                    {
                        await Save(player, a_noTest, a_asyncDelay);
                    }

                    if (action == view.FarkleView.Action.Quit)
                    {
                        Quit();
                    }
                }
            } while (a_noTest);
        }
Exemplo n.º 2
0
 public void DisplayRolledDices_CompareWithConsoleOuput_Equal()
 {
     using (StringWriter sw = new StringWriter())
     {
         Console.SetOut(sw);
         sut.DisplayRolledDices("Rogge", fake_dice_list(), 300, 3000);
         string expected = string.Format("Rogge Rolled: \nDice_1 : Five\nDice_2 : Three\nScore: 300\nTotal-score: 3000\n");
         Assert.Equal(expected, sw.ToString());
     }
 }