public void ImportNull() { ImportAwareImporter importer = new ImportAwareImporter(typeof(Thing)); JsonRecorder writer = new JsonRecorder(); writer.WriteNull(); Assert.IsNull(importer.Import(null, writer.CreatePlayer())); }
public void ImportTellsObjectToImportSelf() { ImportAwareImporter importer = new ImportAwareImporter(typeof(Thing)); JsonRecorder writer = new JsonRecorder(); writer.WriteString(string.Empty); Thing thing = (Thing) importer.Import(null, writer.CreatePlayer()); Assert.IsTrue(thing.ImportCalled); }
public void Registration() { Type type = typeof(Thing); TypeImporterCollection binders = new TypeImporterCollection(); ImportContext context = new ImportContext(); Assert.IsNull(binders.Bind(context, type)); ImportAwareImporter importer = new ImportAwareImporter(type); binders.Add(importer); Assert.AreSame(importer, binders.Bind(context, type)); }
public void CannotSendNullReaderToImport() { ImportAwareImporter importer = new ImportAwareImporter(typeof(Thing)); importer.Import(null, null); }
public void Registration() { Type type = typeof(Thing); JsonImporterCollection importers = new JsonImporterCollection(); Assert.IsNull(importers.Find(type)); ImportAwareImporter importer = new ImportAwareImporter(type); importers.Register(importer); Assert.AreSame(importer, importers.Find(type)); }