Exemplo n.º 1
0
        public void CanReadNumberValue(string data, decimal value)
        {
            using (TextReader stream = new StringReader(data))
            {
                JsonReader reader = new JsonReader(stream);

                while (reader.Next())
                {
                    Assert.Equal(value, Decimal.Parse(reader.Token.GetString(), NumberStyles.Float, CultureInfo.InvariantCulture));
                }
            }
        }
Exemplo n.º 2
0
        public void CanReadTextValue(string data, string value)
        {
            using (TextReader stream = new StringReader(data))
            {
                JsonReader reader = new JsonReader(stream);

                while (reader.Next())
                {
                    Assert.Equal(value, reader.Token.GetString());
                }
            }
        }
Exemplo n.º 3
0
        public void CanReadData(string data)
        {
            using (TextReader stream = new StringReader(data))
            {
                JsonReader reader = new JsonReader(stream);

                while (reader.Next())
                {
                    Assert.False(reader.HasError);
                }

                Assert.False(reader.HasError);
            }
        }
Exemplo n.º 4
0
        public void CanHandleStreamError(string data)
        {
            using (TextReader stream = new StringReader(data))
            {
                JsonReader reader = new JsonReader(stream);

                while (reader.Next()) { }

                Assert.True(reader.HasError);
            }
        }