Code Coverage Statistics for Source File
Newtonsoft.Json.Tests\JsonArrayAttributeTests.cs
Symbol Coverage: 100.00% (31 of 31)
Branch Coverage: 100.00% (5 of 5)
Cyclomatic Complexity Avg: 1.00 Max:1
Code Lines: 31
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 |
||
7 |
namespace Newtonsoft.Json.Tests |
|
8 |
{ |
|
9 |
public class JsonArrayAttributeTests : TestFixtureBase |
|
10 |
{ |
|
11 |
[Test] |
|
12 |
public void IsReferenceTest() |
|
13 |
{ |
|
14 |
1 |
JsonPropertyAttribute attribute = new JsonPropertyAttribute();
|
15 |
1 |
Assert.AreEqual(null, attribute._isReference);
|
16 |
1 |
Assert.AreEqual(false, attribute.IsReference);
|
17 |
||
18 |
1 |
attribute.IsReference = false;
|
19 |
1 |
Assert.AreEqual(false, attribute._isReference);
|
20 |
1 |
Assert.AreEqual(false, attribute.IsReference);
|
21 |
||
22 |
1 |
attribute.IsReference = true;
|
23 |
1 |
Assert.AreEqual(true, attribute._isReference);
|
24 |
1 |
Assert.AreEqual(true, attribute.IsReference);
|
25 |
1 |
}
|
26 |
||
27 |
[Test] |
|
28 |
public void NullValueHandlingTest() |
|
29 |
{ |
|
30 |
1 |
JsonPropertyAttribute attribute = new JsonPropertyAttribute();
|
31 |
1 |
Assert.AreEqual(null, attribute._nullValueHandling);
|
32 |
1 |
Assert.AreEqual(NullValueHandling.Include, attribute.NullValueHandling);
|
33 |
||
34 |
1 |
attribute.NullValueHandling = NullValueHandling.Ignore;
|
35 |
1 |
Assert.AreEqual(NullValueHandling.Ignore, attribute._nullValueHandling);
|
36 |
1 |
Assert.AreEqual(NullValueHandling.Ignore, attribute.NullValueHandling);
|
37 |
1 |
}
|
38 |
||
39 |
[Test] |
|
40 |
public void DefaultValueHandlingTest() |
|
41 |
{ |
|
42 |
1 |
JsonPropertyAttribute attribute = new JsonPropertyAttribute();
|
43 |
1 |
Assert.AreEqual(null, attribute._defaultValueHandling);
|
44 |
1 |
Assert.AreEqual(DefaultValueHandling.Include, attribute.DefaultValueHandling);
|
45 |
||
46 |
1 |
attribute.DefaultValueHandling = DefaultValueHandling.Ignore;
|
47 |
1 |
Assert.AreEqual(DefaultValueHandling.Ignore, attribute._defaultValueHandling);
|
48 |
1 |
Assert.AreEqual(DefaultValueHandling.Ignore, attribute.DefaultValueHandling);
|
49 |
1 |
}
|
50 |
||
51 |
[Test] |
|
52 |
public void ReferenceLoopHandlingTest() |
|
53 |
{ |
|
54 |
1 |
JsonPropertyAttribute attribute = new JsonPropertyAttribute();
|
55 |
1 |
Assert.AreEqual(null, attribute._defaultValueHandling);
|
56 |
1 |
Assert.AreEqual(ReferenceLoopHandling.Error, attribute.ReferenceLoopHandling);
|
57 |
||
58 |
1 |
attribute.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
59 |
1 |
Assert.AreEqual(ReferenceLoopHandling.Ignore, attribute._referenceLoopHandling);
|
60 |
1 |
Assert.AreEqual(ReferenceLoopHandling.Ignore, attribute.ReferenceLoopHandling);
|
61 |
1 |
}
|
62 |
} |
|
63 |
} |