示例#1
0
        public void TestDDStatRollerAllValuesCheck()
        {
            IRollable d = new DiceSet();

            IRollable dd1 = DiceFactory.CreateDDStatRoller();

            ((DiceSet)d).Add(dd1);

            // populate "not yet found" list
            List <int> notFound = new List <int>();

            notFound.AddRange(new int[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 });

            // attempt to find each value
            for (int i = 1; i < 1000; i++)             // arbitrary limit of 10000 maximum tries
            {
                int result = d.Roll();                 // 3 to 18
                notFound.Remove(result);
                if (notFound.Count <= 0)
                {
                    break;                     // all found
                }
            }
            // test
            Assert.AreEqual <int>(0, notFound.Count, "Some values were not rolled on 3 d6.");
        }