예제 #1
0
파일: d4Tests.cs 프로젝트: aloisdg/RollGen
        public void AfterRoll_AlwaysReturnZero()
        {
            partialRoll = new RandomPartialRoll(1, mockRandom.Object);
            mockRandom.Setup(r => r.Next(4)).Returns(42);

            partialRoll.d4();
            var roll = partialRoll.d4();
            Assert.That(roll, Is.EqualTo(0));
        }
예제 #2
0
파일: d4Tests.cs 프로젝트: aloisdg/RollGen
        public void ReturnRollValue()
        {
            partialRoll = new RandomPartialRoll(1, mockRandom.Object);
            mockRandom.Setup(r => r.Next(4)).Returns(42);

            var roll = partialRoll.d4();
            Assert.That(roll, Is.EqualTo(43));
        }
예제 #3
0
파일: d4Tests.cs 프로젝트: aloisdg/RollGen
        public void RollQuantity()
        {
            partialRoll = new RandomPartialRoll(2, mockRandom.Object);
            mockRandom.SetupSequence(r => r.Next(4)).Returns(4).Returns(2);

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