public void PublicParametizedConstructorWithPropertyNameConflictWithAttribute() { string json = @"{name:""1""}"; PublicParametizedConstructorWithPropertyNameConflictWithAttribute c = JsonConvert.DeserializeObject <PublicParametizedConstructorWithPropertyNameConflictWithAttribute>(json); Assert.IsNotNull(c); Assert.AreEqual(1, c.Name); }
public void PublicParametizedConstructorWithPropertyNameConflictWithAttribute() { InMemoryTraceWriter traceWriter = new InMemoryTraceWriter { LevelFilter = TraceLevel.Verbose }; string json = @"{name:""1""}"; PublicParametizedConstructorWithPropertyNameConflictWithAttribute c = JsonConvert.DeserializeObject <PublicParametizedConstructorWithPropertyNameConflictWithAttribute>(json, new JsonSerializerSettings { TraceWriter = traceWriter }); Assert.IsNotNull(c); Assert.AreEqual(1, c.Name); Assert.AreEqual("Deserializing Newtonsoft.Json.Tests.TestObjects.PublicParametizedConstructorWithPropertyNameConflictWithAttribute using creator with parameters: name. Path 'name', line 1, position 6.", traceWriter.TraceRecords[0].Message); }