public void QueryForListOfT_never_returns_null()
        {
            string sql = "SELECT tbl_name FROM sqlite_master WHERE type = 'PSG'";

            using var connection = TestUtil.CreateSQLiteWrappedCnx();
            Assert.True(WrappedConnectionEx.QueryForList(connection, sql, (r) => new { Item1 = r.GetString(0) }).Count() == 0);
        }
Exemple #2
0
 public void QueryForString_works()
 {
     using (var connection = TestUtil.CreateSQLiteWrappedCnx())
     {
         Assert.Equal("azerty", WrappedConnectionEx.QueryForString(connection, "SELECT 'azerty';"));
     }
 }
Exemple #3
0
 public void QueryForLong_works()
 {
     using (var connection = TestUtil.CreateSQLiteWrappedCnx())
     {
         Assert.Equal(1L, WrappedConnectionEx.QueryForLong(connection, "SELECT 1;"));
     }
 }
Exemple #4
0
 public void GetDatabaseServerType_is_sqlite()
 {
     using (var connection = TestUtil.CreateSQLiteWrappedCnx())
     {
         Assert.Equal(DBMS.SQLite, WrappedConnectionEx.GetDatabaseServerType(connection));
     }
 }
        public void QueryForListOfT_works()
        {
            var    expected = new[] { new { Item1 = "azerty", Item2 = "qwerty" } }.ToList();
            string sql = "SELECT 'azerty','qwerty';";

            using var connection = TestUtil.CreateSQLiteWrappedCnx();
            Assert.Equal(expected, WrappedConnectionEx.QueryForList(connection, sql, (r) => new { Item1 = r.GetString(0), Item2 = r.GetString(1) }));
        }
        public void QueryForListOfString_works()
        {
            var expected = new List <string> {
                "azerty", "qwerty"
            };
            string sql = "SELECT 'azerty' UNION SELECT 'qwerty';";

            using var connection = TestUtil.CreateSQLiteWrappedCnx();
            Assert.Equal(expected, WrappedConnectionEx.QueryForListOfString(connection, sql));
        }