Пример #1
0
        public void AfterRoll_AlwaysReturnZero()
        {
            partialRoll = new RandomPartialRoll(1, mockRandom.Object);
            mockRandom.Setup(r => r.Next(10)).Returns(42);

            partialRoll.d10();
            var roll = partialRoll.d10();
            Assert.That(roll, Is.EqualTo(0));
        }
Пример #2
0
        public void ReturnRollValue()
        {
            partialRoll = new RandomPartialRoll(1, mockRandom.Object);
            mockRandom.Setup(r => r.Next(10)).Returns(42);

            var roll = partialRoll.d10();
            Assert.That(roll, Is.EqualTo(43));
        }
Пример #3
0
        public void RollQuantity()
        {
            partialRoll = new RandomPartialRoll(2, mockRandom.Object);
            mockRandom.SetupSequence(r => r.Next(10)).Returns(4).Returns(2);

            var roll = partialRoll.d10();
            Assert.That(roll, Is.EqualTo(8));
        }
Пример #4
0
 public void IfQuantityOverLimit_ThrowArgumentException()
 {
     partialRoll = new RandomPartialRoll(Limits.Quantity + 1, mockRandom.Object);
     Assert.That(() => partialRoll.d10(), Throws.InstanceOf<ArgumentException>().With.Message.EqualTo("Die roll of 16500001d10 is too large for RollGen"));
 }