generated from unity-korea-community/unity-package-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCollectionExtensionTests.cs
55 lines (48 loc) · 1.24 KB
/
CollectionExtensionTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine;
using UNKO.Utils;
public class CollectionExtensionTests
{
[Test]
public void ToStringCollectionExample()
{
string list = new List<int> { 1, 2, 3, 4, 5 }.ToStringCollection();
Debug.Log(list);
string dictionary = new Dictionary<string, int>
{
{"one", 1}, {"two", 2}, {"three", 3},
}.ToStringCollection();
Debug.Log(dictionary);
}
[Test]
public void ForeachExample()
{
int[] originArray = new[] { 1, 2, 3, 4, 5 };
originArray.ForEach(number => Debug.Log(number));
}
[Test]
public void DequeueExample()
{
List<int> list = new List<int> { 1, 2, 3 };
Assert.AreEqual(list.Dequeue(), 1);
Assert.AreEqual(list.Count, 2);
while (list.Count > 0)
{
list.Dequeue();
}
Assert.AreEqual(list.Count, 0);
}
[Test]
public void PopExample()
{
List<int> list = new List<int> { 1, 2, 3 };
Assert.AreEqual(list.Pop(), 3);
Assert.AreEqual(list.Count, 2);
while (list.Count > 0)
{
list.Dequeue();
}
Assert.AreEqual(list.Count, 0);
}
}