Esempio n. 1
0
        public void DieOfAnySidesReturns1ForLowest(
            [Range(1, 3)] int sides)
        {
            TheRandom.m_random = Substitute.For <Random>();
            TheRandom.Next(1, sides + 1).Returns(1);

            Assert.That(Die.Make(sides).Roll() == 1);

            TheRandom.m_random = null;
        }
Esempio n. 2
0
        public void DiceOfAnySidesReturnsItsSidesCountAsHighest(
            [Range(1, 3)] int sides)
        {
            TheRandom.m_random = Substitute.For <Random>();
            TheRandom.Next(1, sides + 1).Returns(sides);

            Assert.That(Die.Make(sides).Roll() == sides);

            TheRandom.m_random = null;
        }
Esempio n. 3
0
 public static string Generate()
 {
     return(BuiltinNames[TheRandom.Next(0, BuiltinNames.Length - 1)]);
 }
Esempio n. 4
0
 virtual public int Roll()
 {
     return(TheRandom.Next(1, m_sides + 1));
 }