Code Coverage Statistics for Source File
Newtonsoft.Json.Tests\Linq\JTokenEqualityComparerTests.cs
Symbol Coverage: 100.00% (28 of 28)
Branch Coverage: 100.00% (5 of 5)
Cyclomatic Complexity Avg: 1.00 Max:1
Code Lines: 28
Symbol Coverage Trend
View:
L | V | Source |
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using NUnit.Framework; |
|
6 |
using Newtonsoft.Json.Linq; |
|
7 |
||
8 |
namespace Newtonsoft.Json.Tests.Linq |
|
9 |
{ |
|
10 |
public class JTokenEqualityComparerTests : TestFixtureBase |
|
11 |
{ |
|
12 |
[Test] |
|
13 |
public void JValueDictionary() |
|
14 |
{ |
|
15 |
1 |
Dictionary<JToken, int> dic = new Dictionary<JToken, int>(JToken.EqualityComparer);
|
16 |
1 |
JValue v11 = new JValue(1);
|
17 |
1 |
JValue v12 = new JValue(1);
|
18 |
||
19 |
1 |
dic[v11] = 1;
|
20 |
1 |
dic[v12] += 1;
|
21 |
1 |
Assert.AreEqual(2, dic[v11]);
|
22 |
1 |
}
|
23 |
||
24 |
[Test] |
|
25 |
public void JArrayDictionary() |
|
26 |
{ |
|
27 |
1 |
Dictionary<JToken, int> dic = new Dictionary<JToken, int>(JToken.EqualityComparer);
|
28 |
1 |
JArray v11 = new JArray();
|
29 |
1 |
JArray v12 = new JArray();
|
30 |
||
31 |
1 |
dic[v11] = 1;
|
32 |
1 |
dic[v12] += 1;
|
33 |
1 |
Assert.AreEqual(2, dic[v11]);
|
34 |
1 |
}
|
35 |
||
36 |
[Test] |
|
37 |
public void JObjectDictionary() |
|
38 |
{ |
|
39 |
1 |
Dictionary<JToken, int> dic = new Dictionary<JToken, int>(JToken.EqualityComparer);
|
40 |
1 |
JObject v11 = new JObject() { { "Test", new JValue(1) }, { "Test1", new JValue(1) } };
|
41 |
1 |
JObject v12 = new JObject() { { "Test", new JValue(1) }, { "Test1", new JValue(1) } };
|
42 |
||
43 |
1 |
dic[v11] = 1;
|
44 |
1 |
dic[v12] += 1;
|
45 |
1 |
Assert.AreEqual(2, dic[v11]);
|
46 |
1 |
}
|
47 |
||
48 |
[Test] |
|
49 |
public void JConstructorDictionary() |
|
50 |
{ |
|
51 |
1 |
Dictionary<JToken, int> dic = new Dictionary<JToken, int>(JToken.EqualityComparer);
|
52 |
1 |
JConstructor v11 = new JConstructor("ConstructorValue");
|
53 |
1 |
JConstructor v12 = new JConstructor("ConstructorValue");
|
54 |
||
55 |
1 |
dic[v11] = 1;
|
56 |
1 |
dic[v12] += 1;
|
57 |
1 |
Assert.AreEqual(2, dic[v11]);
|
58 |
1 |
}
|
59 |
} |
|
60 |
} |