public void WriteEmptyObject() { JsonImportingWriter writer = new JsonImportingWriter(); writer.WriteStartObject(); writer.WriteEndObject(); Assert.AreEqual(0, ((IDictionary) writer.Value).Count); }
public void WriteEmptyObject() { var writer = new JsonImportingWriter(); writer.WriteStartObject(); writer.WriteEndObject(); Assert.AreEqual(0, ((IDictionary)writer.Value).Count); }
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"])); }