public void PrimitiveType_MetadataPropertyIgnore_WithNoType() { ItemWithUntypedPayload actual = JsonConvert.DeserializeObject <ItemWithUntypedPayload>(@"{ ""Payload"": { ""$type"": ""System.Single, mscorlib"", ""$value"": ""5"" } }", new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }); Assert.AreEqual(5f, actual.Payload); actual = JsonConvert.DeserializeObject <ItemWithUntypedPayload>(@"{ ""Payload"": { ""$type"": ""System.Single, mscorlib"", ""$value"": ""5"" } }", new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto, MetadataPropertyHandling = MetadataPropertyHandling.Ignore }); Assert.IsTrue(actual.Payload is JObject); }
public void ReadAhead_JArray_NoParent() { ItemWithUntypedPayload actual = JsonConvert.DeserializeObject <ItemWithUntypedPayload>(@"{ ""Payload"": [1] }", new JsonSerializerSettings { MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); JArray o = (JArray)actual.Payload; Assert.AreEqual(null, o.Parent); }