Пример #1
0
        public void Throws_on_null()
        {
            LongConverter converter = new LongConverter();
            JsonReader    reader    = new JsonTextReader(new StringReader("null"));

            reader.ReadAsString();
            Assert.Throws <JsonException>(
                () => converter.ReadJson(reader, typeof(long), 0L, false, JsonSerializer.CreateDefault()));
        }
Пример #2
0
        public void Can_read_0()
        {
            LongConverter converter = new LongConverter();
            JsonReader    reader    = new JsonTextReader(new StringReader("0"));

            reader.ReadAsString();
            long result = converter.ReadJson(reader, typeof(long), 0L, false, JsonSerializer.CreateDefault());

            Assert.AreEqual(long.Parse("0"), result);
        }
Пример #3
0
        public void Regression_0xa00000()
        {
            LongConverter converter = new LongConverter();
            JsonReader    reader    = new JsonTextReader(new StringReader("0xa00000"));

            reader.ReadAsString();
            long result = converter.ReadJson(reader, typeof(long), 0, false, JsonSerializer.CreateDefault());

            Assert.AreEqual(10485760, result);
        }