public IEnumerator 풀링_이벤트테스트() { g_mapMakeCount = new Dictionary <ETestPoolingObjectName, int>() { { ETestPoolingObjectName.Test3, 0 } }; g_mapPopCount = new Dictionary <ETestPoolingObjectName, int>() { { ETestPoolingObjectName.Test3, 0 } }; g_mapPushCount = new Dictionary <ETestPoolingObjectName, int>() { { ETestPoolingObjectName.Test3, 0 } }; CManagerPooling <ETestPoolingObjectName, TestPoolingObject> pPoolingManager = InitGeneratePoolingTest(); pPoolingManager.p_EVENT_OnMakeResource += PPoolingManager_p_EVENT_OnMakeResource; pPoolingManager.p_EVENT_OnPopResource += PPoolingManager_p_EVENT_OnPopResource; pPoolingManager.p_EVENT_OnPushResource += PPoolingManager_p_EVENT_OnPushResource; int iTotalMakeCount = Random.Range(15, 50); for (int i = 0; i < iTotalMakeCount; i++) { pPoolingManager.DoPop(ETestPoolingObjectName.Test3); } Assert.AreEqual(g_mapMakeCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPopCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPushCount[ETestPoolingObjectName.Test3], 0); pPoolingManager.DoPushAll(); Assert.AreEqual(g_mapMakeCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPopCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPushCount[ETestPoolingObjectName.Test3], iTotalMakeCount); for (int i = 0; i < iTotalMakeCount; i++) { pPoolingManager.DoPop(ETestPoolingObjectName.Test3); } Assert.AreEqual(g_mapMakeCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPopCount[ETestPoolingObjectName.Test3], iTotalMakeCount * 2); Assert.AreEqual(g_mapPushCount[ETestPoolingObjectName.Test3], iTotalMakeCount); pPoolingManager.DoPushAll(); Assert.AreEqual(g_mapMakeCount[ETestPoolingObjectName.Test3], iTotalMakeCount); Assert.AreEqual(g_mapPopCount[ETestPoolingObjectName.Test3], iTotalMakeCount * 2); Assert.AreEqual(g_mapPushCount[ETestPoolingObjectName.Test3], iTotalMakeCount * 2); yield break; }
public IEnumerator 풀링_기본테스트() { CManagerPooling <ETestPoolingObjectName, TestPoolingObject> pPoolingManager = InitGeneratePoolingTest(); Assert.AreEqual(0, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test1]); Assert.AreEqual(0, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test2]); List <GameObject> listObjectPooling = new List <GameObject>(); for (int i = 0; i < 10; i++) { listObjectPooling.Add(pPoolingManager.DoPop(ETestPoolingObjectName.Test1).gameObject); } Assert.AreEqual(10, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test1]); for (int i = 0; i < 10; i++) { pPoolingManager.DoPush(listObjectPooling[i].GetComponent <TestPoolingObject>()); } Assert.AreEqual(0, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test1]); listObjectPooling.Clear(); for (int i = 0; i < 5; i++) { listObjectPooling.Add(pPoolingManager.DoPop(ETestPoolingObjectName.Test2).gameObject); } Assert.AreEqual(5, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test2]); pPoolingManager.DoPushAll(); Assert.AreEqual(0, TestPoolingObject.g_mapActiveCount[ETestPoolingObjectName.Test2]); yield break; }