コード例 #1
0
        public void ApplyTo_NullICharacter()
        {
            // Arrange
            var enchantment = new Etherealness();

            // Act
            TestDelegate applyTo = () => enchantment.ApplyTo(null);

            // Assert
            Assert.Throws <ArgumentNullException>(applyTo);
        }
コード例 #2
0
        public void ApplyTo_Character_SpellLikeAbility()
        {
            // Arrange
            var slaKnown      = Mock.Of <ISpellLikeAbilityCollection>();
            var mockCharacter = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.SpellLikeAbilities.Known)
            .Returns(slaKnown);
            var enchantment = new Etherealness();

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

            // Assert
            Mock.Get(slaKnown)
            .Verify(r => r.Add(It.Is <ISpellLikeAbility>(sla => sla.Spell is EtherealJaunt &&
                                                         1 == sla.UsesPerDay &&
                                                         13 == sla.CasterLevel.GetTotal() &&
                                                         7 == sla.Spell.Level)),
                    "Applying a Etherealness armor enchantment to a character should let the character cast Ethereal Jaunt once per day at caster level 13 using an ability score of 17.");
        }