private static JsonReader EncodeObject(string xml) { JsonRecorder writer = new JsonRecorder(); JsonMLCodec.EncodeObjectForm(new XmlTextReader(new StringReader(xml)), writer); return(writer.CreatePlayer()); }
public void DecodeObjectAllowsEmptyRootElementAsLongAsXmlWriterIsStarted() { StringWriter sw = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(sw); writer.WriteStartElement("root"); JsonMLCodec.Decode(new JsonTextReader(new StringReader("{}")), writer); }
public void EncodeObjectExpectsXmlReaderOnElement() { XmlTextReader reader = new XmlTextReader(new StringReader("<e>text</e>")); reader.Read(); reader.Read(); JsonMLCodec.EncodeObjectForm(reader, new JsonRecorder()); }
private static string DecodeObject(string json) { StringWriter sw = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(sw); writer.QuoteChar = '\''; JsonMLCodec.DecodeObjectForm(new JsonTextReader(new StringReader(json)), writer); return(sw.ToString()); }
public void DecodeDoesNotAcceptNullXmlWriter() { JsonMLCodec.Decode(new JsonRecorder().CreatePlayer(), null); }
public void DecodeDoesNotAcceptNullJsonReader() { JsonMLCodec.Decode(null, new XmlTextWriter(new StringWriter())); }
public void EncodeDoesNotAcceptNullJsonWriter() { JsonMLCodec.Encode(new XmlTextReader("http://www.example.com/"), null); }
public void EncodeDoesNotAcceptNullXmlReader() { JsonMLCodec.Encode(null, new JsonRecorder()); }