-
Notifications
You must be signed in to change notification settings - Fork 0
/
NUnitTests.cs
124 lines (107 loc) · 1.72 KB
/
NUnitTests.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using System.Threading;
using NUnit.Framework;
namespace NUnitTests
{
[TestFixture]
public class InconclusiveTestFixture
{
public void Test()
{
}
}
[TestFixture]
public class NotRunnableTestFixture
{
internal NotRunnableTestFixture()
{
}
[Test]
public void Test1()
{
}
}
[TestFixture]
public class NUnitTests
{
[TestFixture]
public class DerivedFixture
{
[SetUp]
public void Setup()
{
}
[Test]
public void Test()
{
}
}
[Test]
public void FailedTest()
{
Assert.AreEqual(1, 0);
}
[Test, Explicit]
public void ExplicitTest()
{
Assert.AreEqual(1, 1);
}
[Test]
public void ErrorTest()
{
throw new Exception("ERROR!!! interrupted");
Assert.AreEqual(1, 0);
}
[Test]
[Ignore("Test is unstable")]
public void Ignored()
{
Assert.AreEqual(1, 0);
}
[Test]
public void CancelledTest()
{
// need to run nunit with /timeout=10
Thread.Sleep(11);
Assert.AreEqual(1, 1);
}
[Test]
[Platform("Linux")]
public void Skipped()
{
Assert.That(1, Is.EqualTo(1));
}
[Test]
public void SuccessfullTest()
{
Assert.AreEqual(1, 1);
}
[Test]
public void InconclussiveTest()
{
Assert.Inconclusive("Inconclusive Test");
}
[TestCase(1, 1)]
[TestCase(2, 3)]
public void ParameterizedTest(int a, int b)
{
Assert.AreEqual(a, b);
}
static object[] DivideCases =
{
new object[] { 12, 3, 4 },
new object[] { 12, 2, 6 },
new object[] { 12, 4, 3 }
};
[Test, TestCaseSource("DivideCases")]
public void TestWithTestSource(int n, int d, int q)
{
Assert.AreEqual(q, n / d);
}
[Test]
public void InvalidTestCase(int n, int d, int q)
{
Assert.AreEqual(q, n / d);
}
}
}