コード例 #1
0
        public void ApplyTo_NullICharacter_Throws()
        {
            // Arrange
            ICharacter         character = null;
            ImprovedInitiative feat      = new ImprovedInitiative();

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

            // Assert
            Assert.Throws <ArgumentNullException>(applyTo);
        }
コード例 #2
0
        public void ApplyTo_RaisesInitiativeByFour()
        {
            // Arrange
            var bonusTracker = Mock.Of <IModifierTracker>();

            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.Initiative.UntypedBonuses)
            .Returns(bonusTracker);

            ImprovedInitiative feat = new ImprovedInitiative();

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

            // Assert
            Mock.Get(bonusTracker)
            .Verify(bt => bt.Add(It.Is <Func <byte> >(calc => 4 == calc())),
                    "Improved Initiative did not correctly apply a +4 untyped bonus to the character's initiative.");
        }