public void GetRollReturnsSameObjectThatWasPlacedAtGivenIndex() { Roll r1 = new Roll('5'); Frame f = new Frame(); f.AddRoll(r1); Assert.AreSame(r1, f.GetRoll(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); }
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; }
public void ToIntValueConvertsArbitraryStrNumberToInt() { Roll r1 = new Roll('4'); Assert.AreEqual(4, r1.ToIntValue()); }
public void RollsMayBeAdded() { Roll r1 = new Roll('5'); Roll r2 = new Roll('4'); Assert.AreEqual(9, r1 + r2); }
public void RollsExplicitlyConvertedToIntegers() { Roll r1 = new Roll('5'); Assert.AreEqual(5, (int)r1); }
public void ConstructorSetsValueToParameter() { Roll r1 = new Roll('1'); Assert.AreEqual('1', r1.Value); }
public void ConstructorInitializesToZero() { Roll r1 = new Roll(); Assert.AreEqual('-', r1.Value); }
public void ConstructorDoesNotAllowInvalidValues() { Roll r1 = new Roll('f'); }
public void ToIntValueConvertsSpareTo10() { Roll r1 = new Roll('/'); Assert.AreEqual(10, r1.ToIntValue()); }
public void ToIntValueConvertsStrikeTo11() { Roll r1 = new Roll('X'); Assert.AreEqual(11, r1.ToIntValue()); }
public void ToIntValueConvertsHyphenToZero() { Roll r1 = new Roll('-'); Assert.AreEqual(0, r1.ToIntValue()); }
public static int Value(this Roll roll) { return((int)roll); }