public void ApplyTo_NullCharacter_Throws() { // Arrange var enchantment = new Invulnerability(false); // Act TestDelegate applyTo = () => enchantment.ApplyTo(null); // Assert Assert.Throws <ArgumentNullException>(applyTo); }
public void ApplyTo_ICharacter_BestowsDR() { // Arrange var damageReductions = Mock.Of <IDamageReductionTracker>(); var mockCharacter = new Mock <ICharacter>(); mockCharacter.Setup(c => c.DamageReduction) .Returns(damageReductions); var enchantment = new Invulnerability(false); // Act enchantment.ApplyTo(mockCharacter.Object); // Assert Mock.Get(damageReductions) .Verify(dr => dr.Add(It.Is <Func <byte> >(calc => 5 == calc()), It.Is <string>(str => "Magic" == str)), "Invulnerability armor enchantment failed to add DR 5/Magic to the ICharacter."); }