예제 #1
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]));
        }
예제 #2
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]);
        }