Beispiel #1
0
        public void Create()
        {
			IDatabase db = new Database(_provider, _connstring);
            IDbConnection conn = db.Create();
			conn.ShouldNotBe(null);
            conn.State.ShouldBe(ConnectionState.Closed);
        }
Beispiel #2
0
        public void Instantiate()
        {
			IDatabase db = new Database(_provider, _connstring);
			db.ShouldNotBe(null);
			db.IsSqlServerProvider.ShouldBe(true);
			db.IsSqlServerCeProvider.ShouldBe(false);
			db.IsOracleProvider.ShouldBe(false);
        }
Beispiel #3
0
        public void UseConnection()
        {
			IDatabase db = new Database(_provider, _connstring);
			using (IDbConnection conn = db.Create())
			{
				conn.ShouldNotBe(null);
                conn.Open();
                conn.State.ShouldBe(ConnectionState.Open);
				
	            using (IDbCommand cmd = conn.CreateCommand())
	            {
	                cmd.CommandText = "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES";
					var count = cmd.ExecuteScalar();
                    count.ShouldBeAssignableTo<int>();
                    count.ShouldNotBe(0);
	            }
			}
        }