Esempio n. 1
0
 public Game()
 {
     RemainingAttempts = Attempts;
     IsWon             = false;
     currentResults    = new List <PositionFeedback>();
     targetNumber      = new TargetNumber(SequenceLength, NumberMax, NumberMin);
     messages          = new List <string>();
 }
Esempio n. 2
0
        public void Test_TargetNumber_Creation()
        {
            // won't compile, that's good
            //var tn = new TargetNumber();

            var tn = new TargetNumber(4, 1, 6);

            //4, 1, 6);

            //position too low
            Assert.ThrowsException <ArgumentException>(() => tn.CheckDigit(-1, 4));

            // position too high
            Assert.ThrowsException <ArgumentException>(() => tn.CheckDigit(12, 4));

            // number too low
            Assert.ThrowsException <ArgumentException>(() => tn.CheckDigit(12, -1));

            // number too high
            Assert.ThrowsException <ArgumentException>(() => tn.CheckDigit(12, 8));
        }