|
const string | Name = "TestName" |
|
◆ SetUp()
◆ TearDown()
33 {
35 }
TPooler _pooler
Definition: PoolingObjectsTests.cs:25
◆ GetObject_Base()
39 {
40 var actual =
_pooler.GetObject();
41 Assert.IsTrue(actual.activeSelf);
42 Assert.AreEqual($"{Name}(Clone)", actual.name);
43 }
◆ GetObject_PrefabWithComponents()
47 {
48 _prefab.AddComponent<ExampleComponent>();
49 var actual =
_pooler.GetObject();
50 Assert.IsNotNull(actual.transform.GetComponent<ExampleComponent>());
51 }
GameObject _prefab
Definition: PoolingObjectsTests.cs:26
◆ GetObject_Reusability()
55 {
56 var first =
_pooler.GetObject();
58 var second =
_pooler.GetObject();
59 Assert.AreSame(first, second);
60 }
virtual void FreeObject(GameObject item)
Definition: PoolingObjectsTests.cs:123
◆ GetObject_NotInRoot()
64 {
65 var actual =
_pooler.GetObject();
66 Assert.NotNull(actual.transform.parent);
67 }
◆ GetObject_SameParent()
71 {
72 var first =
_pooler.GetObject();
73 var second =
_pooler.GetObject();
74 Assert.AreSame(first.transform.parent, second.transform.parent);
75 }
◆ GetObject_DefaultPosition()
79 {
80 Vector3 position = new Vector3(1, 2, 3);
81 Quaternion rotation = Quaternion.Euler(4, 5, 6);
82 var actual =
_pooler.GetObject(position, rotation);
83 Assert.AreEqual(position, actual.transform.position);
84 Assert.AreEqual(rotation, actual.transform.rotation);
85 }
◆ GetObject_MultipleGetsNewElements()
89 {
90 var history = new List<GameObject>();
91 for (int i = 0; i < 5; i++)
92 {
93 var actual =
_pooler.GetObject();
94 Assert.IsFalse(history.Contains(actual), $"Id: {i}");
95 history.Add(actual);
96 }
97 }
◆ GetObject_MultipleGetExistingElements()
101 {
102 const int Length = 5;
103 var objects = new List<GameObject>(Length);
104
105 for (int i = 0; i < Length; i++)
106 {
107 var actual =
_pooler.GetObject();
108 objects.Add(actual);
109 }
110
111 foreach (var item in objects)
112 {
114 }
115
116 for (int i = 0; i < Length; i++)
117 {
118 var actual =
_pooler.GetObject();
119 Assert.IsTrue(objects.Contains(actual), $"Id: {i}");
120 }
121 }
◆ FreeObject()
◆ Name
◆ _pooler
◆ _prefab
The documentation for this class was generated from the following file: