Пример #1
0
        public void ReadDecimalOnlyDecimalPlaces()
        {
            var str = new StringReader(".10057g");

            using (var reader = new TypeTextReader(str))
            {
                var testVal = reader.ReadDecimal();
                Assert.Equal(.10057M, testVal);
                Assert.Equal('g', (char)reader.BaseReader.Peek());
            }
        }
Пример #2
0
        public void ReadNegativeDecimal()
        {
            var str = new StringReader("-20z");

            using (var reader = new TypeTextReader(str))
            {
                var value = reader.ReadDecimal();
                Assert.Equal(value, -20.0M);
                Assert.Equal('z', (char)reader.BaseReader.Peek());
            }
        }
Пример #3
0
        public void ReadDecimalWithDecimalPlaces()
        {
            var str = new StringReader("175.357s");

            using (var reader = new TypeTextReader(str))
            {
                var testVal = reader.ReadDecimal();
                Assert.Equal(175.357M, testVal);
                Assert.Equal('s', (char)reader.BaseReader.Peek());
            }
        }