Exemplo n.º 1
0
 public void GetRollReturnsSameObjectThatWasPlacedAtGivenIndex()
 {
     Roll r1 = new Roll('5');
     Frame f = new Frame();
     f.AddRoll(r1);
     Assert.AreSame(r1, f.GetRoll(0));
 }
Exemplo n.º 2
0
        public void AddRollsIncreasesFrameSizeByNumberOfArguments()
        {
            Roll r1 = new Roll('-');
            Roll r2 = new Roll('1');
            Roll r3 = new Roll('2');
            Frame f = new Frame(3);

            f.AddRolls(r1, r2, r3);
            Assert.AreEqual(3, f.Size);
        }
Exemplo n.º 3
0
        public void AddRoll(Roll r)
        {
            if (Size >= _maxSize)
            {
                throw new FrameFullException(
                    string.Format(
                        "Frame already contains maximum amount ({0}) of rolls",
                        _maxSize));
            }

            _rolls[Size++] = r;
        }
Exemplo n.º 4
0
 public void ToIntValueConvertsArbitraryStrNumberToInt()
 {
     Roll r1 = new Roll('4');
     Assert.AreEqual(4, r1.ToIntValue());
 }
Exemplo n.º 5
0
 public void RollsMayBeAdded()
 {
     Roll r1 = new Roll('5');
     Roll r2 = new Roll('4');
     Assert.AreEqual(9, r1 + r2);
 }
Exemplo n.º 6
0
 public void RollsExplicitlyConvertedToIntegers()
 {
     Roll r1 = new Roll('5');
     Assert.AreEqual(5, (int)r1);
 }
Exemplo n.º 7
0
 public void ConstructorSetsValueToParameter()
 {
     Roll r1 = new Roll('1');
     Assert.AreEqual('1', r1.Value);
 }
Exemplo n.º 8
0
 public void ConstructorInitializesToZero()
 {
     Roll r1 = new Roll();
     Assert.AreEqual('-', r1.Value);
 }
Exemplo n.º 9
0
 public void ConstructorDoesNotAllowInvalidValues()
 {
     Roll r1 = new Roll('f');
 }
Exemplo n.º 10
0
        public void ToIntValueConvertsSpareTo10()
        {
            Roll r1 = new Roll('/');

            Assert.AreEqual(10, r1.ToIntValue());
        }
Exemplo n.º 11
0
 public void ToIntValueConvertsStrikeTo11()
 {
     Roll r1 = new Roll('X');
     Assert.AreEqual(11, r1.ToIntValue());
 }
Exemplo n.º 12
0
        public void RollsExplicitlyConvertedToIntegers()
        {
            Roll r1 = new Roll('5');

            Assert.AreEqual(5, (int)r1);
        }
Exemplo n.º 13
0
 public void ConstructorDoesNotAllowInvalidValues()
 {
     Roll r1 = new Roll('f');
 }
Exemplo n.º 14
0
        public void ToIntValueConvertsHyphenToZero()
        {
            Roll r1 = new Roll('-');

            Assert.AreEqual(0, r1.ToIntValue());
        }
Exemplo n.º 15
0
        public void ToIntValueConvertsStrikeTo11()
        {
            Roll r1 = new Roll('X');

            Assert.AreEqual(11, r1.ToIntValue());
        }
Exemplo n.º 16
0
 public void ToIntValueConvertsHyphenToZero()
 {
     Roll r1 = new Roll('-');
     Assert.AreEqual(0, r1.ToIntValue());
 }
Exemplo n.º 17
0
        public void ConstructorSetsValueToParameter()
        {
            Roll r1 = new Roll('1');

            Assert.AreEqual('1', r1.Value);
        }
Exemplo n.º 18
0
 public void ToIntValueConvertsSpareTo10()
 {
     Roll r1 = new Roll('/');
     Assert.AreEqual(10, r1.ToIntValue());
 }
Exemplo n.º 19
0
        public void ToIntValueConvertsArbitraryStrNumberToInt()
        {
            Roll r1 = new Roll('4');

            Assert.AreEqual(4, r1.ToIntValue());
        }
Exemplo n.º 20
0
 public static int Value(this Roll roll)
 {
     return((int)roll);
 }
Exemplo n.º 21
0
        public void ConstructorInitializesToZero()
        {
            Roll r1 = new Roll();

            Assert.AreEqual('-', r1.Value);
        }