public DictionaryInterfaceClass() { Dictionary = new Dictionary <string, int> { { "existing", 1 } }; Collection = new List <int> { 1, 2, 3 }; Employee = new EmployeeReference { Name = "EmployeeName!" }; }
public DictionaryInterfaceClass() { Dictionary = new Dictionary<string, int> { { "existing", 1 } }; Collection = new List<int> { 1, 2, 3 }; Employee = new EmployeeReference { Name = "EmployeeName!" }; }
public void WriteTypeNameForObjects() { string employeeRef = ReflectionUtils.GetTypeName(typeof(EmployeeReference), FormatterAssemblyStyle.Simple); EmployeeReference employee = new EmployeeReference(); string json = JsonConvert.SerializeObject(employee, Formatting.Indented, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects }); Assert.AreEqual(@"{ ""$id"": ""1"", ""$type"": """ + employeeRef + @""", ""Name"": null, ""Manager"": null }", json); }