public void CreateObject()
 {
     ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));
     ImportContext context = new ImportContext();
     ObjectConstructionResult result = ctor.CreateObject(context, JsonText.CreateReader("{y:2000,m:12,d:4}"));
     Assert.IsNotNull(result);
     Assert.AreEqual(new DateTime(2000, 12, 4), result.Object);
 }
Пример #2
0
        public void CreateObject()
        {
            ObjectSurrogateConstructor ctor  = new ObjectSurrogateConstructor(typeof(Surrogate));
            ImportContext            context = new ImportContext();
            ObjectConstructionResult result  = ctor.CreateObject(context, JsonText.CreateReader("{y:2000,m:12,d:4}"));

            Assert.IsNotNull(result);
            Assert.AreEqual(new DateTime(2000, 12, 4), result.Object);
        }
 public void SurrogateTypeInitialization()
 {
     ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));
     Assert.AreEqual(typeof(Surrogate), ctor.SurrogateType);
 }
 public void CannotCreateObjectWithNullJsonReader()
 {
     ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));
     ctor.CreateObject(new ImportContext(), null);
 }
 public void CannotCreateObjectWithNullImportContext()
 {
     ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));
     ctor.CreateObject(null, StockJsonBuffers.EmptyObject.CreateReader());
 }
Пример #6
0
        public void CannotCreateObjectWithNullJsonReader()
        {
            ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));

            ctor.CreateObject(new ImportContext(), null);
        }
Пример #7
0
        public void CannotCreateObjectWithNullImportContext()
        {
            ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));

            ctor.CreateObject(null, StockJsonBuffers.EmptyObject.CreateReader());
        }
Пример #8
0
        public void SurrogateTypeInitialization()
        {
            ObjectSurrogateConstructor ctor = new ObjectSurrogateConstructor(typeof(Surrogate));

            Assert.AreEqual(typeof(Surrogate), ctor.SurrogateType);
        }