示例#1
0
        public void ApplyTo_NullICharacter_Throws()
        {
            // Arrange
            ICharacter character = null;
            Dodge      feat      = new Dodge();

            // Act
            TestDelegate constructor = () => feat.ApplyTo(character);

            // Assert
            Assert.Throws <ArgumentNullException>(constructor);
        }
示例#2
0
        public void ApplyTo_RaisesAcDodgeByOne()
        {
            var dodgeTracker = Mock.Of <IModifierTracker>();

            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.ArmorClass.DodgeBonuses)
            .Returns(dodgeTracker);

            Dodge feat = new Dodge();

            // Act
            feat.ApplyTo(mockCharacter.Object);

            // Assert
            Mock.Get(dodgeTracker)
            .Verify(dt => dt.Add(It.Is <Func <byte> >(calc => 1 == calc())),
                    "Dodge bonus did not correctly add a +1 bonus to the character's armor class's dodge bonus tracker.");
        }