public void ContractResolverInsideConverter() { var test = new MultipleDataTablesJsonTest { TableWrapper1 = new DataTableWrapper { DataTableProperty = CreateDataTable(3, "Table1Col") }, TableWrapper2 = new DataTableWrapper { DataTableProperty = CreateDataTable(3, "Table2Col") } }; string json = JsonConvert.SerializeObject( test, Formatting.Indented, new LowercaseDataTableConverter() ); StringAssert.AreEqual( @"{ ""TableWrapper1"": { ""DataTableProperty"": [ { ""table1col1"": ""1"", ""table1col2"": ""2"", ""table1col3"": ""3"" } ], ""StringProperty"": null, ""IntProperty"": 0 }, ""TableWrapper2"": { ""DataTableProperty"": [ { ""table2col1"": ""1"", ""table2col2"": ""2"", ""table2col3"": ""3"" } ], ""StringProperty"": null, ""IntProperty"": 0 } }", json ); }
public void ContractResolverInsideConverter() { var test = new MultipleDataTablesJsonTest { TableWrapper1 = new DataTableWrapper { DataTableProperty = CreateDataTable(3, "Table1Col") }, TableWrapper2 = new DataTableWrapper { DataTableProperty = CreateDataTable(3, "Table2Col") } }; string json = JsonConvert.SerializeObject(test, Formatting.Indented, new LowercaseDataTableConverter()); StringAssert.AreEqual(@"{ ""TableWrapper1"": { ""DataTableProperty"": [ { ""table1col1"": ""1"", ""table1col2"": ""2"", ""table1col3"": ""3"" } ], ""StringProperty"": null, ""IntProperty"": 0 }, ""TableWrapper2"": { ""DataTableProperty"": [ { ""table2col1"": ""1"", ""table2col2"": ""2"", ""table2col3"": ""3"" } ], ""StringProperty"": null, ""IntProperty"": 0 } }", json); }