public void UpdateContainer_IsItemCountCorrect() { DummyPoolContainer container = CreateTestContainer(); IEnumerable <Weapon> weapons = CreateWeaponsList(5); container.UpdateContainer(weapons); Assert.AreEqual(container.Items.Count(), 5); }
public void UpdateContainer_IsItemActivated() { DummyPoolContainer container = CreateTestContainer(); List <Weapon> weapons = CreateWeaponsList(1); container.UpdateContainer(weapons); Assert.AreEqual(container.GetComponentsInChildren <DummyItem>().Length, 1); }
public void IsInitialPoolSizeAllDeactivated() { DummyPoolContainer container = CreateTestContainer(); foreach (Transform child in container.transform) { Assert.IsFalse(child.gameObject.activeSelf); } }
public void Clear_ArePoolItemsNotDestroyed() { DummyPoolContainer container = CreateTestContainer(); List <Weapon> weapons = CreateWeaponsList(1); container.UpdateContainer(weapons); container.Clear(); Assert.AreEqual(container.transform.childCount, 21); }
public void UpdateContainer_AreNewItemsNotInstanstiated() { DummyPoolContainer container = CreateTestContainer(); List <Weapon> weapons = CreateWeaponsList(1); Assert.AreEqual(container.transform.childCount, 21); container.UpdateContainer(weapons); Assert.AreEqual(container.transform.childCount, 21); }
private DummyPoolContainer CreateTestContainer() { GameObject containerGo = new GameObject(); GameObject itemGo = new GameObject(); itemGo.transform.SetParent(containerGo.transform); DummyPoolContainer container = containerGo.AddComponent <DummyPoolContainer>(); DummyItem item = itemGo.AddComponent <DummyItem>(); container.ItemTemplate = item; container.Initialize(); return(container); }
public void IsInitializedWithInitialPoolSize() { DummyPoolContainer container = CreateTestContainer(); Assert.AreEqual(container.transform.childCount, 21); }