Beispiel #1
0
 public void Save_TextWriter()
 {
     JsonArray array = new JsonArray(new JsonPrimitive(true), null);
     using (StringWriter writer = new StringWriter())
     {
         array.Save(writer);
         Assert.Equal("[true, null]", writer.ToString());
     }
 }
Beispiel #2
0
 public void Save_NullStream_ThrowsArgumentNullException()
 {
     JsonArray array = new JsonArray();
     Assert.Throws<ArgumentNullException>("stream", () => array.Save((Stream)null));
     Assert.Throws<ArgumentNullException>("textWriter", () => array.Save((TextWriter)null));
 }
Beispiel #3
0
 public void Save_Stream()
 {
     JsonArray array = new JsonArray(new JsonPrimitive(true), null);
     using (MemoryStream stream = new MemoryStream())
     {
         array.Save(stream);
         string result = Encoding.UTF8.GetString(stream.ToArray());
         Assert.Equal("[true, null]", result);
     }
 }