Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        public void ApplyAfterDefending_ShouldNotChangeAnyICreaturesInBattleProperties()
        {
            var creaturesInBattle = new Mock <ICreaturesInBattle>(MockBehavior.Strict);

            var addDefenseWhenSkip = new AddDefenseWhenSkip(5);

            addDefenseWhenSkip.ApplyAfterDefending(creaturesInBattle.Object);

            creaturesInBattle.VerifyAll();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void ReturnCorrectPermanentDefense_WhenApplyOnSkipIsCalled()
        {
            var defenceWhenSkip = new AddDefenseWhenSkip(2);

            var creaturesInBattle = new CreaturesInBattle(new Angel(), 1);

            defenceWhenSkip.ApplyOnSkip(creaturesInBattle);

            Assert.AreEqual(22, creaturesInBattle.PermanentDefense);
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void ReturnCorrectStringFormat_WhenToStringIsCalled()
        {
            var defenceWhenSkip = new AddDefenseWhenSkip(2);

            Assert.AreEqual("AddDefenseWhenSkip(2)", defenceWhenSkip.ToString());
        }
Exemplo n.º 8
0
        public void ThrowArgumentNullException_ApplyOnSkipIsCalledWithNullCreature()
        {
            var defenceWhenSkip = new AddDefenseWhenSkip(2);

            Assert.Throws <ArgumentNullException>(() => defenceWhenSkip.ApplyOnSkip(null));
        }