コード例 #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);
        }
コード例 #2
0
 public void PlayerAction_SendArgumentString3_ReturnsActionNewGame()
 {
     view.FarkleView.Action actual   = sut.PlayerAction("3");
     view.FarkleView.Action expected = view.FarkleView.Action.NewGame;
     Assert.Equal(expected, actual);
 }