コード例 #1
0
 public void GetRawScoreAccountsForPreviousRollWhenCalculatingSpare()
 {
     Frame f = new Frame();
     f.AddRoll(new Roll('1'));
     f.AddRoll(new Roll('/'));
     Assert.AreEqual(10, f.GetRawScore());
 }
コード例 #2
0
 public void GetRollScoreCanBeUsedToGetASingleRollsScore()
 {
     Frame f = new Frame();
     f.AddRoll(new Roll('1'));
     f.AddRoll(new Roll('8'));
     Assert.AreEqual(1, f.GetRollScore(0));
     Assert.AreEqual(8, f.GetRollScore(1));
 }
コード例 #3
0
        public void GetRawScoreAccountsForPreviousRollWhenCalculatingSpare()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('1'));
            f.AddRoll(new Roll('/'));
            Assert.AreEqual(10, f.GetRawScore());
        }
コード例 #4
0
        public void OverfillFrameThrowsFrameFullExceptionWhenAddingTooManyRolls()
        {
            Frame f = new Frame(2);

            f.AddRoll(new Roll('-'));
            f.AddRoll(new Roll('-'));
            f.AddRoll(new Roll('-'));
        }
コード例 #5
0
        public void GetRollScoreCanBeUsedToGetASingleRollsScore()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('1'));
            f.AddRoll(new Roll('8'));
            Assert.AreEqual(1, f.GetRollScore(0));
            Assert.AreEqual(8, f.GetRollScore(1));
        }
コード例 #6
0
        public void GetRawScoreAddsRollsAsRawValues()
        {
            Frame f = new Frame();
            f.AddRoll(new Roll('1'));
            Assert.AreEqual(1, f.GetRawScore());
            f.AddRoll(new Roll('X'));

            // 12 because X is technically 11
            Assert.AreEqual(12, f.GetRawScore());
        }
コード例 #7
0
        public void GetRawScoreAddsRollsAsRawValues()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('1'));
            Assert.AreEqual(1, f.GetRawScore());
            f.AddRoll(new Roll('X'));

            // 12 because X is technically 11
            Assert.AreEqual(12, f.GetRawScore());
        }
コード例 #8
0
 public void GetRollReturnsSameObjectThatWasPlacedAtGivenIndex()
 {
     Roll r1 = new Roll('5');
     Frame f = new Frame();
     f.AddRoll(r1);
     Assert.AreSame(r1, f.GetRoll(0));
 }
コード例 #9
0
        public void AddRollIncreasesFrameSize()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('-'));
            Assert.AreEqual(1, f.Size);
        }
コード例 #10
0
        public void GetRollScoreThrowsExceptionWhenIndexIsOutOfRange()
        {
            Frame f = new Frame();

            f.AddRoll(new Roll('7'));
            Assert.AreEqual(0, f.GetRollScore(10));
        }
コード例 #11
0
        public void GetRollReturnsSameObjectThatWasPlacedAtGivenIndex()
        {
            Roll  r1 = new Roll('5');
            Frame f  = new Frame();

            f.AddRoll(r1);
            Assert.AreSame(r1, f.GetRoll(0));
        }
コード例 #12
0
 public void GetRollScoreThrowsExceptionWhenIndexIsOutOfRange()
 {
     Frame f = new Frame();
     f.AddRoll(new Roll('7'));
     Assert.AreEqual(0, f.GetRollScore(10));
 }
コード例 #13
0
 public void AddRollIncreasesFrameSize()
 {
     Frame f = new Frame();
     f.AddRoll(new Roll('-'));
     Assert.AreEqual(1, f.Size);
 }
コード例 #14
0
 public void OverfillFrameThrowsFrameFullExceptionWhenAddingTooManyRolls()
 {
     Frame f = new Frame(2);
     f.AddRoll(new Roll('-'));
     f.AddRoll(new Roll('-'));
     f.AddRoll(new Roll('-'));
 }