-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelperMethods.cs
executable file
·46 lines (36 loc) · 1.13 KB
/
HelperMethods.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
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework.Constraints;
namespace NUnit.Framework {
// NUnit.Should setups up our .Should() syntax
//
// These are additional .Should*() helper methods to help us
// write specs that may be easier to read
public static partial class ShouldExtensions {
public static void ShouldEqual<T>(this T a, T b) {
a.Should(Be.EqualTo(b));
}
public static void ShouldNotEqual<T>(this T a, T b) {
a.ShouldNot(Be.EqualTo(b));
}
public static void ShouldContain<T>(this IEnumerable<T> list, T item) {
list.Should(Contain.Item(item));
}
public static void ShouldNotContain<T>(this IEnumerable<T> list, T item) {
list.ShouldNot(Contain.Item(item));
}
public static void ShouldContain(this string full, string part) {
full.Should(Be.StringContaining(part));
}
public static void ShouldNotContain(this string full, string part) {
full.ShouldNot(Be.StringContaining(part));
}
public static void ShouldBeFalse(this bool b) {
b.Should(Be.False);
}
public static void ShouldBeTrue(this bool b) {
b.Should(Be.True);
}
}
}