Repository navigation
Expand file tree
/
Copy pathMyTest.cs
More file actions
84 lines (73 loc) · 2.13 KB
/
Copy pathMyTest.cs
File metadata and controls
84 lines (73 loc) · 2.13 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using NUnit.Framework;
public class UnityAssertExample
{
[Test]
public void TestAssertAreEqual()
{
int x = 5;
Assert.AreEqual(5, x); // İki değeri karşılaştırır ve eşit olup olmadığını kontrol eder.
}
[Test]
public void TestAssertAreNotEqual()
{
int x = 5;
int y = 10;
Assert.AreNotEqual(x, y); // İki değeri karşılaştırır ve eşit olmadığını kontrol eder.
}
[Test]
public void TestAssertIsTrue()
{
bool condition = true;
Assert.IsTrue(condition); // Belirtilen koşulun doğru (true) olup olmadığını kontrol eder.
}
[Test]
public void TestAssertIsFalse()
{
bool condition = false;
Assert.IsFalse(condition); // Belirtilen koşulun yanlış (false) olup olmadığını kontrol eder.
}
[Test]
public void TestAssertIsNull()
{
string str = null;
Assert.IsNull(str); // Bir nesnenin null olup olmadığını kontrol eder.
}
[Test]
public void TestAssertIsNotNull()
{
string str = "Hello";
Assert.IsNotNull(str); // Bir nesnenin null olmadığını kontrol eder.
}
[Test]
public void TestAssertAreSame()
{
object obj1 = new object();
object obj2 = obj1;
Assert.AreSame(obj1, obj2); // İki nesnenin aynı nesne referansına sahip olup olmadığını kontrol eder.
}
[Test]
public void TestAssertAreNotSame()
{
object obj1 = new object();
Assert.AreNotSame(obj1, new object()); // İki nesnenin aynı nesne referansına sahip olmadığını kontrol eder.
}
[Test]
public void TestAssertGreater()
{
int x = 5;
int y = 10;
Assert.Greater(y, x); // Bir değerin diğerinden büyük olduğunu kontrol eder.
}
[Test]
public void TestAssertLess()
{
int x = 5;
int y = 10;
Assert.Less(x, y); // Bir değerin diğerinden küçük olduğunu kontrol eder.
}
[Test]
public void TestAssertDoesNotThrow()
{
Assert.DoesNotThrow(() => { int result = 5 / 2; }); // Belirtilen kodun herhangi bir istisna (exception) fırlatmadığını kontrol eder.
}
}