コード例 #1
0
 public void ImportNull()
 {
     ComponentImporter importer = new ComponentImporter(typeof(object));
     Assert.IsNull(importer.Import(new ImportContext(), CreateReader("null")));
 }
コード例 #2
0
 public void SkipsReadOnlyProperty()
 {
     Type thingType = typeof(Thing);
     JsonTextReader reader = new JsonTextReader(new StringReader("{ Id : 42 }"));
     TestTypeDescriptor descriptor = new TestTypeDescriptor();
     descriptor.AddReadOnlyProperty("Id");
     ComponentImporter importer = new ComponentImporter(thingType, descriptor);
     importer.Import(new ImportContext(), reader);
     Assert.IsFalse(descriptor.GetProperty("Id").SetValueCalled);
 }