示例#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));
 }