Exemplo n.º 1
0
        public void GetOfType_ListWithOneItemOfGivenType_ReturnListWithThatOneItem()
        {
            GameEffectList effectList = NewGameEffectList();
            var            effect     = new GameSpellEffect(null, 0, 0);

            effectList.Add(effect);

            IGameEffect actual = effectList.GetOfType <GameSpellEffect>();

            Assert.IsNotNull(actual);
        }
Exemplo n.º 2
0
        public void CancelAll_EffectContainsOneEffect_EffectIsCancelled()
        {
            GameEffectList effectList = createEffectListWithValidOwner();
            var            effect     = Substitute.For <IGameEffect>();

            effectList.Add(effect);

            effectList.CancelAll();

            effect.Received().Cancel(false);
        }
Exemplo n.º 3
0
        public void CancelAll_EffectContainsOneEffect_EffectIsCancelled()
        {
            GameEffectList effectList = NewGameEffectList();
            var            effect     = NewFakeEffect();

            effectList.Add(effect);

            effectList.CancelAll();

            Assert.IsTrue(effect.receivedCancel);
        }
Exemplo n.º 4
0
        public void Remove_EffectFromListContainingDifferentEffect_ReturnFalse()
        {
            GameEffectList effectList      = NewGameEffectList();
            var            effect          = NewFakeEffect();
            var            differentEffect = NewFakeEffect();

            effectList.Add(differentEffect);

            bool actual = effectList.Remove(effect);

            Assert.AreEqual(false, actual);
        }
Exemplo n.º 5
0
        public void Add_OwnerIsNotAlive_ReturnFalse()
        {
            var owner = Substitute.For <GameLiving>();

            owner.IsAlive.Returns(false);
            var effectList = new GameEffectList(owner);
            var effect     = Substitute.For <IGameEffect>();

            bool actual = effectList.Add(effect);

            Assert.AreEqual(false, actual);
        }
Exemplo n.º 6
0
        public void Remove_EffectFromListContainingDifferentEffect_ReturnFalse()
        {
            GameEffectList effectList      = createEffectListWithValidOwner();
            var            effect          = Substitute.For <IGameEffect>();
            var            differentEffect = Substitute.For <IGameEffect>();

            effectList.Add(differentEffect);

            bool actual = effectList.Remove(effect);

            Assert.AreEqual(false, actual);
        }
Exemplo n.º 7
0
        public void Remove_EffectFromListContainingSameEffect_ListCountIsZero()
        {
            GameEffectList effectList = NewGameEffectList();
            var            effect     = NewFakeEffect();

            effectList.Add(effect);

            effectList.Remove(effect);

            int actual = effectList.Count;

            Assert.AreEqual(0, actual);
        }
Exemplo n.º 8
0
        public void Add_OwnerIsActiveObjectAndAlive_ReturnTrue()
        {
            var owner = Substitute.For <GameLiving>();

            owner.IsAlive.Returns(true);
            owner.ObjectState = GameObject.eObjectState.Active;
            var effectList = new GameEffectList(owner);
            var effect     = Substitute.For <IGameEffect>();

            bool actual = effectList.Add(effect);

            Assert.AreEqual(true, actual);
        }
Exemplo n.º 9
0
        public void Remove_EffectFromListContainingSameEffect_ListCountIsZero()
        {
            GameEffectList effectList = createEffectListWithValidOwner();
            var            effect     = Substitute.For <IGameEffect>();

            effectList.Add(effect);

            effectList.Remove(effect);

            int actual = effectList.Count;

            Assert.AreEqual(0, actual);
        }
Exemplo n.º 10
0
        public void Add_ToFreshListAndOwnerIsNotAlive_ListCountRemainsZero()
        {
            var owner = Substitute.For <GameLiving>();

            owner.IsAlive.Returns(false);
            var effectList = new GameEffectList(owner);
            var effect     = Substitute.For <IGameEffect>();

            effectList.Add(effect);

            int actual = effectList.Count;

            Assert.AreEqual(0, actual);
        }
Exemplo n.º 11
0
        public void Add_ToFreshListAndOwnerIsAliveAndActiveObject_ListCountIsOne()
        {
            var owner = Substitute.For <GameLiving>();

            owner.IsAlive.Returns(true);
            owner.ObjectState = GameObject.eObjectState.Active;
            var effectList = new GameEffectList(owner);
            var effect     = Substitute.For <IGameEffect>();

            effectList.Add(effect);

            int actual = effectList.Count;

            Assert.AreEqual(1, actual);
        }
Exemplo n.º 12
0
        public void Remove_EffectFromListContainingSameEffect_ReturnTrue()
        {
            var owner = Substitute.For <GameLiving>();

            owner.IsAlive.Returns(true);
            owner.ObjectState = GameObject.eObjectState.Active;
            var effectList = new GameEffectList(owner);
            var effect     = Substitute.For <IGameEffect>();

            effectList.Add(effect);

            bool actual = effectList.Remove(effect);

            Assert.AreEqual(true, actual);
        }