public void TestRoundTrip() { object inObject = true; object outObject; string s; using (Stream output = new MemoryStream()) { IWriter <object> w = TransitFactory.Writer <object>(TransitFactory.Format.JsonVerbose, output); w.Write(inObject); output.Position = 0; var sr = new StreamReader(output); s = sr.ReadToEnd(); } byte[] buffer = Encoding.ASCII.GetBytes(s); using (Stream input = new MemoryStream(buffer)) { IReader reader = TransitFactory.Reader(TransitFactory.Format.Json, input); outObject = reader.Read <object>(); } Assert.IsTrue(IsEqual(inObject, outObject)); }
public IReader Reader(string s) { Stream input = new MemoryStream(Encoding.Default.GetBytes(s)); return(TransitFactory.Reader(TransitFactory.Format.Json, input)); }