示例#1
0
        public void Dynamic()
        {
            _connection.Open();
            var entity = new AdoHelper <dynamic>(_connection)
                         .Query("SELECT * FROM TestTable")
                         .ExecuteReader();

            _connection.Close();

            var model = entity.First();

            Assert.AreEqual(5, ((IDictionary <String, Object>)model).Count);

            Assert.AreEqual("Hello", model.TEXTFIELD);
            Assert.AreEqual(123.123, model.FLOATFIELD, 10e-5);
            Assert.AreEqual(123, model.NUMERICFIELD);
            Assert.AreEqual(123, model.INTEGERFIELD);
        }
示例#2
0
        public void Dynamic()
        {
            _connection.Open();
            var entity = new AdoHelper <dynamic>(_connection)
                         .Query("SELECT * FROM TestTable")
                         .ExecuteReader();

            _connection.Close();

            var model = entity.First();

            Assert.AreEqual(5, ((IDictionary <String, Object>)model).Count);

            Assert.AreEqual("Hello", model.TextField);
            Assert.AreEqual(123.123, model.FloatField);
            Assert.AreEqual(123, model.NumericField);
            Assert.AreEqual(123, model.IntegerField);
        }
示例#3
0
        public void Collection()
        {
            _connection.Open();
            var entity = new AdoHelper <ICollection <string> >(_connection)
                         .Query("SELECT * FROM TestTable")
                         .ExecuteReader();

            _connection.Close();

            Assert.AreNotEqual(0, entity.Count());

            var model = entity.First().ToList();

            Assert.AreEqual(5, model.Count);
            Assert.AreEqual("Hello", model[1]);
            Assert.AreEqual(123.123, double.Parse(model[2]), 10e-5);
            Assert.AreEqual(123M, decimal.Parse(model[3]));
            Assert.AreEqual(123, int.Parse(model[4]));
        }
示例#4
0
        public void List()
        {
            _connection.Open();
            var entity = new AdoHelper <List <string> >(_connection)
                         .Query("SELECT * FROM TestTable")
                         .ExecuteReader();

            _connection.Close();

            Assert.AreNotEqual(0, entity.Count());

            var model = entity.First();

            Assert.AreEqual(5, model.Count);
            Assert.AreEqual("Hello", model[1]);
            Assert.AreEqual("123.123", model[2].Replace(',', '.'));
            Assert.AreEqual("123", model[3]);
            Assert.AreEqual("123", model[4]);
        }