Playground by Górka Mateusz
Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler > Class Template Referenceabstract
+ Inheritance diagram for Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >:

Public Member Functions

abstract void SetUp ()
 
virtual void TearDown ()
 
void GetObject_Base ()
 
void GetObject_PrefabWithComponents ()
 
void GetObject_Reusability ()
 
void GetObject_NotInRoot ()
 
void GetObject_SameParent ()
 
void GetObject_DefaultPosition ()
 
void GetObject_MultipleGetsNewElements ()
 
void GetObject_MultipleGetExistingElements ()
 

Protected Member Functions

virtual void FreeObject (GameObject item)
 

Protected Attributes

GameObject _prefab
 

Static Protected Attributes

const string Name = "TestName"
 

Package Attributes

TPooler _pooler
 

Member Function Documentation

◆ SetUp()

◆ TearDown()

virtual void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.TearDown ( )
inlinevirtual
33 {
34 _pooler.IsTestFinished = true;
35 }
TPooler _pooler
Definition: PoolingObjectsTests.cs:25

◆ GetObject_Base()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_Base ( )
inline
39 {
40 var actual = _pooler.GetObject();
41 Assert.IsTrue(actual.activeSelf);
42 Assert.AreEqual($"{Name}(Clone)", actual.name);
43 }

◆ GetObject_PrefabWithComponents()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_PrefabWithComponents ( )
inline
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()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_Reusability ( )
inline
55 {
56 var first = _pooler.GetObject();
57 FreeObject(first);
58 var second = _pooler.GetObject();
59 Assert.AreSame(first, second);
60 }
virtual void FreeObject(GameObject item)
Definition: PoolingObjectsTests.cs:123

◆ GetObject_NotInRoot()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_NotInRoot ( )
inline
64 {
65 var actual = _pooler.GetObject();
66 Assert.NotNull(actual.transform.parent);
67 }

◆ GetObject_SameParent()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_SameParent ( )
inline
71 {
72 var first = _pooler.GetObject();
73 var second = _pooler.GetObject();
74 Assert.AreSame(first.transform.parent, second.transform.parent);
75 }

◆ GetObject_DefaultPosition()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_DefaultPosition ( )
inline
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()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_MultipleGetsNewElements ( )
inline
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()

void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.GetObject_MultipleGetExistingElements ( )
inline
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 {
113 FreeObject(item);
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()

virtual void Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.FreeObject ( GameObject  item)
inlineprotectedvirtual

Reimplemented in Goo.Tests.Editor.Pooling.ExtendedObjectPoolerTests.

124 {
125 item.SetActive(false);
126 }

Member Data Documentation

◆ Name

const string Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >.Name = "TestName"
staticprotected

◆ _pooler

TPooler Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >._pooler
package

◆ _prefab

GameObject Goo.Tests.Editor.Pooling.PoolingObjectsTests< TPooler >._prefab
protected

The documentation for this class was generated from the following file: