public void ApplyOnSkip_ShouldThrow_IfPassedICreaturesInBattleParameterIsNull() { ICreaturesInBattle creaturesInBattle = null; var addDefenseWhenSkip = new AddDefenseWhenSkip(5); var resultingException = Assert.Throws <ArgumentNullException>(() => addDefenseWhenSkip.ApplyOnSkip(creaturesInBattle)); Assert.IsTrue(resultingException.Message.Contains("skipCreature")); }
public void ApplyAfterDefending_ShouldNotChangeAnyICreaturesInBattleProperties() { var creaturesInBattle = new Mock <ICreaturesInBattle>(MockBehavior.Strict); var addDefenseWhenSkip = new AddDefenseWhenSkip(5); addDefenseWhenSkip.ApplyAfterDefending(creaturesInBattle.Object); creaturesInBattle.VerifyAll(); }
public void ApplyOnSkip_ShouldAssignTheCorrectValue_WhenPassedAValidParameter() { var expectedDefenseToAdd = 5; var addDefenseWhenSkip = new AddDefenseWhenSkip(expectedDefenseToAdd); var privateAddDefenseOnSkip = new msTest.PrivateObject(addDefenseWhenSkip); var actualValue = privateAddDefenseOnSkip.GetField("defenseToAdd"); Assert.AreEqual(expectedDefenseToAdd, actualValue); }
public void ReturnCorrectPermanentDefense_WhenApplyOnSkipIsCalled() { var defenceWhenSkip = new AddDefenseWhenSkip(2); var creaturesInBattle = new CreaturesInBattle(new Angel(), 1); defenceWhenSkip.ApplyOnSkip(creaturesInBattle); Assert.AreEqual(22, creaturesInBattle.PermanentDefense); }
public void ApplyWhenDefending_ShouldNotChangeAnyICreaturesInBattleProperties() { var attacker = new Mock <ICreaturesInBattle>(MockBehavior.Strict); var defender = new Mock <ICreaturesInBattle>(); var addDefenseWhenSkip = new AddDefenseWhenSkip(5); addDefenseWhenSkip.ApplyWhenDefending(attacker.Object, defender.Object); attacker.VerifyAll(); }
public void ApplyOnSkip_ShouldAccessICreaturesInBattlePermanentDefenseSetter() { var creaturesInBattle = new Mock <ICreaturesInBattle>(); creaturesInBattle.SetupGet(creature => creature.PermanentDefense).Returns(0); creaturesInBattle.SetupSet(creature => creature.PermanentDefense = 0); var addDefenseWhenSkip = new AddDefenseWhenSkip(5); addDefenseWhenSkip.ApplyOnSkip(creaturesInBattle.Object); creaturesInBattle.Verify(creature => creature.PermanentDefense, Times.Once); }
public void ReturnCorrectStringFormat_WhenToStringIsCalled() { var defenceWhenSkip = new AddDefenseWhenSkip(2); Assert.AreEqual("AddDefenseWhenSkip(2)", defenceWhenSkip.ToString()); }
public void ThrowArgumentNullException_ApplyOnSkipIsCalledWithNullCreature() { var defenceWhenSkip = new AddDefenseWhenSkip(2); Assert.Throws <ArgumentNullException>(() => defenceWhenSkip.ApplyOnSkip(null)); }