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); }
public void CancelAll_EffectContainsOneEffect_EffectIsCancelled() { GameEffectList effectList = createEffectListWithValidOwner(); var effect = Substitute.For <IGameEffect>(); effectList.Add(effect); effectList.CancelAll(); effect.Received().Cancel(false); }
public void CancelAll_EffectContainsOneEffect_EffectIsCancelled() { GameEffectList effectList = NewGameEffectList(); var effect = NewFakeEffect(); effectList.Add(effect); effectList.CancelAll(); Assert.IsTrue(effect.receivedCancel); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }