Esempio n. 1
0
        public void WriteNumber()
        {
            var writer = new JsonImportingWriter();

            writer.WriteNumber("1234");
            Assert.AreEqual(new JsonNumber("1234"), GetSingleValue(writer));
        }
Esempio n. 2
0
 public void WriteArray()
 {
     JsonImportingWriter writer = new JsonImportingWriter();
     writer.WriteStartArray();
     writer.WriteNumber(123);
     writer.WriteString("Hello World");
     writer.WriteBoolean(true);
     writer.WriteEndArray();
     Assert.AreEqual(new object[] { new JsonNumber("123"), "Hello World", true }, GetArray(writer));
 }
Esempio n. 3
0
        public void WriteArray()
        {
            var writer = new JsonImportingWriter();

            writer.WriteStartArray();
            writer.WriteNumber(123);
            writer.WriteString("Hello World");
            writer.WriteBoolean(true);
            writer.WriteEndArray();
            Assert.AreEqual(new object[] { new JsonNumber("123"), "Hello World", true }, GetArray(writer));
        }
Esempio n. 4
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"]));
        }
Esempio n. 5
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"]));
 }
Esempio n. 6
0
 public void WriteNumber()
 {
     JsonImportingWriter writer = new JsonImportingWriter();
     writer.WriteNumber("1234");
     Assert.AreEqual(new JsonNumber("1234"), GetSingleValue(writer));
 }