public void WriteNumber() { var writer = new JsonImportingWriter(); writer.WriteNumber("1234"); Assert.AreEqual(new JsonNumber("1234"), GetSingleValue(writer)); }
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)); }
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)); }
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"])); }
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"])); }
public void WriteNumber() { JsonImportingWriter writer = new JsonImportingWriter(); writer.WriteNumber("1234"); Assert.AreEqual(new JsonNumber("1234"), GetSingleValue(writer)); }