public void ApplyAfterDefending_ShouldThrowWithCorrectMessage_IfDefenderWithSpecialtyParamenterIsNull() { ICreaturesInBattle defenderWithSpecialty = null; var specialty = new Resurrection(); var exception = Assert.Throws <ArgumentNullException>(() => specialty.ApplyAfterDefending(defenderWithSpecialty)); StringAssert.Contains("defenderWithSpecialty", exception.Message); }
public void ReturnCorrectTotalHitPoints_WhenApplyAfterDefendingIsCalled() { var resurrection = new Resurrection(); var angel = new Angel(); var creaturesInBattle = new CreaturesInBattle(angel, 1); resurrection.ApplyAfterDefending(creaturesInBattle); Assert.AreEqual(200, creaturesInBattle.TotalHitPoints); }
public void ApplyAfterDefending_ShouldNotSetDefenderWithSpecialtyTotalHitPoints_WhenTotalHitPointsAreLessThanOrEqualToZero() { var defenderWithSpecialty = new Mock <ICreaturesInBattle>(); defenderWithSpecialty.SetupGet(mock => mock.TotalHitPoints).Returns(0); defenderWithSpecialty.SetupSet(mock => mock.TotalHitPoints = It.IsAny <int>()); var specialty = new Resurrection(); specialty.ApplyAfterDefending(defenderWithSpecialty.Object); defenderWithSpecialty.VerifySet(mock => mock.TotalHitPoints = It.IsAny <int>(), Times.Never()); }
public void AppleyAfterDefending_ShouldSetDefenderWithSpecialtyTotalHitPoiints_WhenTotalHitPointsIsLargerThanZero() { var stubCreature = new FakeCreature(); var defenderWithSpecialty = new Mock <ICreaturesInBattle>(); defenderWithSpecialty.SetupGet(mock => mock.Count).Returns(1); defenderWithSpecialty.SetupGet(mock => mock.Creature).Returns(stubCreature); defenderWithSpecialty.SetupGet(mock => mock.TotalHitPoints).Returns(10); defenderWithSpecialty.SetupSet(mock => mock.TotalHitPoints = It.IsAny <int>()); var specialty = new Resurrection(); specialty.ApplyAfterDefending(defenderWithSpecialty.Object); defenderWithSpecialty.VerifySet(mock => mock.TotalHitPoints = It.IsAny <int>(), Times.Once()); }
public void ThrowArgumentNullException_WhenApplyAfterDefendingIsCalledWithNullDefender() { var resurrection = new Resurrection(); Assert.Throws <ArgumentNullException>(() => resurrection.ApplyAfterDefending(null)); }