コード例 #1
0
        public void StringValueTest()
        {
            var value  = _ionValueFactory.NewString("test");
            var reader = new UserTreeReader(value);

            Assert.AreEqual(IonType.String, reader.MoveNext());
            Assert.AreEqual("test", reader.StringValue());
        }
コード例 #2
0
        public void NullValueTest()
        {
            var value  = _ionValueFactory.NewNull();
            var reader = new UserTreeReader(value);

            Assert.AreEqual(IonType.Null, reader.MoveNext());
            Assert.IsTrue(reader.CurrentIsNull);
        }
コード例 #3
0
        public void SingleDoubleNumberTest()
        {
            var value  = _ionValueFactory.NewFloat(123.456);
            var reader = new UserTreeReader(value);

            Assert.AreEqual(IonType.Float, reader.MoveNext());
            Assert.AreEqual(123.456, reader.DoubleValue());
        }
コード例 #4
0
        public void NullParentHasNext()
        {
            var value  = _ionValueFactory.NewInt(123);
            var reader = new UserTreeReader(value);

            Assert.AreEqual(IonType.Int, reader.MoveNext());
            Assert.IsFalse(reader.HasNext());
        }
コード例 #5
0
        public void TimestampTest()
        {
            var timestamp = new Timestamp(DateTime.Now);
            var value     = _ionValueFactory.NewTimestamp(timestamp);
            var reader    = new UserTreeReader(value);

            Assert.AreEqual(IonType.Timestamp, reader.MoveNext());
            Assert.AreEqual(timestamp, reader.TimestampValue());
        }
コード例 #6
0
        public void SingleDecimalNumberTest()
        {
            var decimalValue = new BigDecimal(decimal.MaxValue);
            var value        = _ionValueFactory.NewDecimal(decimalValue);
            var reader       = new UserTreeReader(value);

            Assert.AreEqual(IonType.Decimal, reader.MoveNext());
            Assert.AreEqual(decimalValue, reader.DecimalValue());
        }
コード例 #7
0
        public void CurrentTypeTest()
        {
            var value  = _ionValueFactory.NewBool(true);
            var reader = new UserTreeReader(value);

            Assert.AreEqual(IonType.None, reader.CurrentType);

            reader.MoveNext();
            Assert.AreEqual(IonType.Bool, reader.CurrentType);
        }