Пример #1
0
        public void Can_Deserialize_Decimal_With_Four_Zeros_After_Floating_Point()
        {
            const string json     = "{\"Value\":0.00005557}";
            RestResponse response = new RestResponse {
                Content = json
            };
            JsonDeserializer d      = new JsonDeserializer();
            DecimalNumber    result = d.Deserialize <DecimalNumber>(response);

            Assert.AreEqual(result.Value, .00005557m);
        }
Пример #2
0
        public void Can_Deserialize_Exponential_Notation()
        {
            const string     content = "{ \"Value\": 4.8e-04 }";
            JsonDeserializer json    = new JsonDeserializer();
            DecimalNumber    output  = json.Deserialize <DecimalNumber>(new RestResponse {
                Content = content
            });
            decimal expected = decimal.Parse("4.8e-04", NumberStyles.Float, CultureInfo.InvariantCulture);

            Assert.NotNull(output);
            Assert.AreEqual(expected, output.Value);
        }