Пример #1
0
 public void T04TwoGutterBalls()
 {
     bowls.Add(0);
     Assert.AreEqual(tidy, ActionMaster.GetNextAction(bowls));
     bowls.Add(0);
     Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
 }
Пример #2
0
    /// <summary>
    /// Records a bowl with the specified pinfall and triggers the next action.
    /// </summary>
    /// <param name="pinFall"></param>
    public void BowlComplete(int pinFall)
    {
        // If the game is complete, ignore the bowl
        if (gameComplete)
        {
            return;
        }

        try {
            // Update the list of bowls and frame scores
            bowls.Add(pinFall);
            frameScores = ScoreMaster.ScoreFrames(bowls);
            scoreDisplay.FillBowls(bowls);
            scoreDisplay.FillFrames(frameScores);
            popupController.SetScore(frameScores.LastOrDefault <int>());

            // Perform the next action
            ActionMaster.Action nextAction = ActionMaster.GetNextAction(bowls);
            PerformAction(nextAction);
        } catch (Exception ex) {
            if (ex is SystemException || ex is UnityException)
            {
                Debug.LogWarning("Exception occurred during BowlComplete method: " + ex.ToString() + ex.StackTrace);
            }
            else
            {
                throw;
            }
        }
    }
Пример #3
0
    public void T07AllStrikes()
    {
        // Check first nine frames behave correctly
        for (int i = 0; i < 9; i++)
        {
            bowls.Add(10);
            Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
        }

        // Check tenth frame behaves correctly
        bowls.Add(10);
        Assert.AreEqual(reset, ActionMaster.GetNextAction(bowls));
        bowls.Add(10);
        Assert.AreEqual(reset, ActionMaster.GetNextAction(bowls));
        bowls.Add(10);
        Assert.AreEqual(endGame, ActionMaster.GetNextAction(bowls));
    }
Пример #4
0
    public void T05AllGutterBalls()
    {
        // Check first nine frames behave correctly
        for (int i = 0; i < 9; i++)
        {
            bowls.Add(0);
            Assert.AreEqual(tidy, ActionMaster.GetNextAction(bowls));
            bowls.Add(0);
            Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
        }

        // Check tenth frame behaves correctly
        bowls.Add(0);
        Assert.AreEqual(tidy, ActionMaster.GetNextAction(bowls));
        bowls.Add(0);
        Assert.AreEqual(endGame, ActionMaster.GetNextAction(bowls));
    }
Пример #5
0
    public void T08StrikeThenGutterballsOnLastFrame()
    {
        // Check first nine frames behave correctly
        for (int i = 0; i < 9; i++)
        {
            bowls.Add(10);
            Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
        }

        // Check tenth frame behaves correctly
        bowls.Add(10);
        Assert.AreEqual(reset, ActionMaster.GetNextAction(bowls));
        bowls.Add(0);
        Assert.AreEqual(tidy, ActionMaster.GetNextAction(bowls));
        bowls.Add(0);
        Assert.AreEqual(endGame, ActionMaster.GetNextAction(bowls));
    }
Пример #6
0
 public void T03BowlTwoThenEightReturnsEndTurn()
 {
     bowls.Add(2);
     bowls.Add(8);
     Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
 }
Пример #7
0
 public void T02BowlEightReturnsTidy()
 {
     bowls.Add(8);
     Assert.AreEqual(tidy, ActionMaster.GetNextAction(bowls));
 }
Пример #8
0
 public void T01OneStrikeReturnsEndTurn()
 {
     bowls.Add(10);
     Assert.AreEqual(endTurn, ActionMaster.GetNextAction(bowls));
 }