public void CreateObject()
 {
     object obj = new object();
     Surrogate surrogate = new Surrogate(obj);
     ImportContext context = new ImportContext();
     ObjectConstructionResult result = surrogate.CreateObject(context);
     Assert.AreSame(obj, result.Object);
     JsonReader tail = result.TailReader;
     tail.ReadToken(JsonTokenClass.Object);
     tail.ReadToken(JsonTokenClass.EndObject);
 }
        public void CreateObject()
        {
            var obj       = new object();
            var surrogate = new Surrogate(obj);
            var context   = new ImportContext();
            var result    = surrogate.CreateObject(context);

            Assert.AreSame(obj, result.Object);
            var tail = result.TailReader;

            tail.ReadToken(JsonTokenClass.Object);
            tail.ReadToken(JsonTokenClass.EndObject);
        }
        public void ImportNonObjectMember()
        {
            var surrogate = new Surrogate(new object());
            var context   = new ImportContext();

            surrogate.Import(context, "foo", JsonText.CreateReader("bar"));
            var tail = surrogate.CreateObject(context).TailReader;

            tail.ReadToken(JsonTokenClass.Object);
            Assert.AreEqual("foo", tail.ReadMember());
            Assert.AreEqual("bar", tail.ReadString());
            tail.ReadToken(JsonTokenClass.EndObject);
        }
        public void CreateObject()
        {
            object                   obj       = new object();
            Surrogate                surrogate = new Surrogate(obj);
            ImportContext            context   = new ImportContext();
            ObjectConstructionResult result    = surrogate.CreateObject(context);

            Assert.AreSame(obj, result.Object);
            JsonReader tail = result.TailReader;

            tail.ReadToken(JsonTokenClass.Object);
            tail.ReadToken(JsonTokenClass.EndObject);
        }
 public void ImportNonObjectMember()
 {
     Surrogate surrogate = new Surrogate(new object());
     ImportContext context = new ImportContext();
     surrogate.Import(context, "foo", JsonText.CreateReader("bar"));
     JsonReader tail = surrogate.CreateObject(context).TailReader;
     tail.ReadToken(JsonTokenClass.Object);
     Assert.AreEqual("foo", tail.ReadMember());
     Assert.AreEqual("bar", tail.ReadString());
     tail.ReadToken(JsonTokenClass.EndObject);
 }