Exemplo n.º 1
0
        public void JsonExpressionWriter_InvalidOperation_EndArray()
        {
            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                var w = new JsonExpressionWriter();
                w.WriteEndArray();
            });

            Assert.ThrowsException <InvalidOperationException>(() =>
            {
                var w = new JsonExpressionWriter();
                w.WriteValue(1);
                w.WriteEndArray();
            });
        }
Exemplo n.º 2
0
 public void JsonExpressionWriter_InvalidOperation_EndArray_NoValidElement()
 {
     foreach (var write in new Action <JsonExpressionWriter>[]
     {
         w => w.WritePropertyName("foo"),
         w => w.WriteStartObject(),
     })
     {
         Assert.ThrowsException <InvalidOperationException>(() =>
         {
             var w = new JsonExpressionWriter();
             w.WriteStartArray();
             write(w);
             w.WriteEndArray();
         });
     }
 }