Пример #1
0
 public void WriteEmptyObject()
 {
     JsonImportingWriter writer = new JsonImportingWriter();
     writer.WriteStartObject();
     writer.WriteEndObject();
     Assert.AreEqual(0, ((IDictionary) writer.Value).Count);
 }
Пример #2
0
        public void WriteEmptyObject()
        {
            var writer = new JsonImportingWriter();

            writer.WriteStartObject();
            writer.WriteEndObject();
            Assert.AreEqual(0, ((IDictionary)writer.Value).Count);
        }
Пример #3
0
        public void WriteObject()
        {
            var writer = new JsonImportingWriter();

            writer.WriteStartObject();
            writer.WriteMember("Name");
            writer.WriteString("John Doe");
            writer.WriteMember("Salary");
            writer.WriteNumber(123456789);
            writer.WriteEndObject();
            Assert.IsNotNull(writer.Value);
            var obj = (IDictionary)writer.Value;

            Assert.AreEqual(2, obj.Count);
            Assert.AreEqual("John Doe", obj["Name"]);
            Assert.AreEqual(123456789, Convert.ToInt32(obj["Salary"]));
        }
Пример #4
0
 public void WriteObject()
 {
     JsonImportingWriter writer = new JsonImportingWriter();
     writer.WriteStartObject();
     writer.WriteMember("Name");
     writer.WriteString("John Doe");
     writer.WriteMember("Salary");
     writer.WriteNumber(123456789);
     writer.WriteEndObject();
     Assert.IsNotNull(writer.Value);
     IDictionary obj = (IDictionary) writer.Value;
     Assert.AreEqual(2, obj.Count);
     Assert.AreEqual("John Doe", obj["Name"]);
     Assert.AreEqual(123456789, Convert.ToInt32(obj["Salary"]));
 }