forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnumerableExtensionsTests.cs
More file actions
88 lines (74 loc) · 2.15 KB
/
Copy pathEnumerableExtensionsTests.cs
File metadata and controls
88 lines (74 loc) · 2.15 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
85
86
87
88
using NUnit.Framework;
using ServiceStack.Common;
using System.Linq;
using ServiceStack.Text;
namespace ServiceStack.Common.Tests
{
[TestFixture]
public class EnumerableExtensionsTests
{
readonly int[] IntValues = new[] { 1, 2, 3 };
readonly int[] NoValues = new int[]{};
readonly int[] DifferentValues = new[] { 5, 6, 7};
readonly int[] MoreIntValues = new[] { 1, 2, 3, 4 };
readonly int[] LessIntValues = new[] { 1, 2 };
readonly int[] UnorderedIntValues = new[] { 3, 2, 1 };
readonly string[] StringValues = new[] { "A", "B", "C" };
readonly string[] NoStringValues = new string[] { };
[Test]
public void Can_Join()
{
Assert.That(IntValues.Join(), Is.EqualTo("1,2,3"));
}
[Test]
public void EquivalentTo_self()
{
Assert.That(IntValues.EquivalentTo(IntValues), Is.True);
}
[Test]
public void EquivalentTo_List()
{
Assert.That(IntValues.EquivalentTo(IntValues.ToList()), Is.True);
}
[Test]
public void Not_EquivalentTo_NoValues()
{
Assert.That(IntValues.EquivalentTo(NoValues), Is.False);
}
[Test]
public void Not_EquivalentTo_DifferentValues()
{
Assert.That(IntValues.EquivalentTo(DifferentValues), Is.False);
}
[Test]
public void Not_EquivalentTo_LessIntValues()
{
Assert.That(IntValues.EquivalentTo(LessIntValues), Is.False);
}
[Test]
public void Not_EquivalentTo_MoreIntValues()
{
Assert.That(IntValues.EquivalentTo(MoreIntValues), Is.False);
}
[Test]
public void Not_EquivalentTo_UnorderedIntValues()
{
Assert.That(IntValues.EquivalentTo(UnorderedIntValues), Is.False);
}
[Test]
public void Not_EquivalentTo_null()
{
Assert.That(IntValues.EquivalentTo(null), Is.False);
}
[Test]
public void EquivalentTo_StringValues()
{
Assert.That(StringValues.EquivalentTo(NoStringValues), Is.False);
Assert.That(NoStringValues.EquivalentTo(StringValues), Is.False);
Assert.That(NoStringValues.EquivalentTo(NoStringValues), Is.True);
Assert.That(StringValues.EquivalentTo(StringValues), Is.True);
Assert.That(StringValues.EquivalentTo(new string[] { null }), Is.False);
Assert.That(new string[] { null }.EquivalentTo(StringValues), Is.False);
}
}
}