예제 #1
0
    public void T10StrikeInLastFrame()
    {
        int[]  bowls       = { 1, 2, 3, 4, 10, 0, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4, 4, 5, 10 };
        string bowlsString = "1234 X9—8172635445X";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #2
0
    public void T00NoBowls()
    {
        List <int> bowls       = new List <int>();
        string     bowlsString = "";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #3
0
    public void T09SpareInLastFrameWithFollowup()
    {
        int[]  bowls       = { 1, 2, 3, 4, 5, 5, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4, 4, 5, 6, 4, 5 };
        string bowlsString = "12345╱9—81726354456╱5";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #4
0
    public void T06SpareThenThirdBowl()
    {
        int[]  bowls       = { 3, 7, 4 };
        string bowlsString = "3╱4";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #5
0
    public void T07StrikeThenThirdBowl()
    {
        int[]  bowls       = { 10, 0, 5 };
        string bowlsString = " X5";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #6
0
    public void T04OneStrike()
    {
        int[]  bowls       = { 10, 0 };
        string bowlsString = " X";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #7
0
    public void T05OneGutterball()
    {
        int[]  bowls       = { 0 };
        string bowlsString = "—";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #8
0
    public void T02TwoBowls()
    {
        int[]  bowls       = { 1, 2 };
        string bowlsString = "12";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #9
0
    public void T03OneSpare()
    {
        int[]  bowls       = { 2, 8 };
        string bowlsString = "2╱";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #10
0
    public void T01OneBowl()
    {
        int[]  bowls       = { 1 };
        string bowlsString = "1";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #11
0
    public void T19GutterballSpareThenStrikeInLastFrame()
    {
        int[]  bowls       = { 1, 2, 3, 4, 5, 5, 9, 0, 8, 1, 7, 2, 6, 3, 5, 4, 4, 5, 0, 10, 10 };
        string bowlsString = "12345╱9—8172635445—╱X";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #12
0
    public void T18DontDisplaySpareAcrossFrames()
    {
        int[]  bowls       = { 8, 2, 7, 0, 0, 10, 7, 2, 8, 0 };
        string bowlsString = "8╱7——╱728—";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #13
0
    public void T16AllStrikes()
    {
        int[]  bowls       = { 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 0, 10, 10, 10 };
        string bowlsString = " X X X X X X X X XXXX";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #14
0
    public void T15AllSpares()
    {
        int[]  bowls       = { 0, 10, 1, 9, 2, 8, 3, 7, 4, 6, 5, 5, 6, 4, 7, 3, 8, 2, 9, 1, 10 };
        string bowlsString = "—╱1╱2╱3╱4╱5╱6╱7╱8╱9╱X";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #15
0
    public void T14AllGutterballs()
    {
        int[]  bowls       = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        string bowlsString = "————————————————————";

        Assert.AreEqual(bowlsString, ScoreDisplay.FormatBowls(bowls.ToList()));
    }
예제 #16
0
    /// <summary>
    /// Fills the bowl displays using the provided list of bowls.
    /// </summary>
    /// <param name="bowls">The bowls to display.</param>
    public void FillBowls(List <int> bowls)
    {
        // Format the list of bowls into a string
        string formattedBowls = ScoreDisplay.FormatBowls(bowls);

        // Display one character of the string in each text display
        for (int i = 0; i < formattedBowls.Length; i++)
        {
            bowlDisplays[i].text = formattedBowls[i].ToString();
        }
    }