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; }
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; }
public static string Generate() { return(BuiltinNames[TheRandom.Next(0, BuiltinNames.Length - 1)]); }
virtual public int Roll() { return(TheRandom.Next(1, m_sides + 1)); }