Json.NET
Code Coverage Statistics for Source File

Newtonsoft.Json.Tests\TestObjects\PersonError.cs

Symbol Coverage: 75.00% (6 of 8)

Branch Coverage: 91.67% (11 of 12)

Cyclomatic Complexity Avg: 1.10 Max:2

Code Lines: 7


L V Source
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Runtime.Serialization;
5
using System.Text;
6
using Newtonsoft.Json.Serialization;
7

  
8
namespace Newtonsoft.Json.Tests.TestObjects
9
{
10
  public class PersonError
11
  {
12
    private List<string> _roles;
13

  
14
    public string Name { get; set; }
15
    public int Age { get; set; }
16
    public List<string> Roles
17
    {
18
      get
19
      {
20
 1
        if (_roles == null)
21
 1
          throw new Exception("Roles not loaded!");
22

  
23
 0
        return _roles;
24
 0
      }
25
 1
      set { _roles = value; }
26
    }
27
    public string Title { get; set; }
28

  
29
    [OnError]
30
    internal void HandleError(StreamingContext context, ErrorContext errorContext)
31
    {
32
 1
      errorContext.Handled = true;
33
 1
    }
34
  }
35
}