public static async Task TestDatabase(IDatabase database, Assembly assembly = null, string resourceFile = "Butterfly.Core.Test.db.sql")
        {
            await database.CreateFromResourceFileAsync(assembly ?? Assembly.GetExecutingAssembly(), resourceFile);

            database.SetDefaultValue("id", tableName => Guid.NewGuid().ToString(), "employee");
            database.SetDefaultValue("created_at", tableName => DateTime.Now);
            database.SetDefaultValue("updated_at", tableName => DateTime.Now);

            await DatabaseUnitTest.TruncateData(database);

            (object salesDepartmentId, object hrDepartmentId, object customerServiceDepartmentId) = await DatabaseUnitTest.InsertBasicData(database);
            await TestInsertUpdateDeleteEvents(database, salesDepartmentId, "SELECT * FROM employee", "name", "Joe Sales, Jr", 5, 1, 1, 1);
            await TestInsertUpdateDeleteEvents(database, salesDepartmentId, "SELECT id, name FROM employee", "department_id", -1, 5, 1, 0, 1);

            if (database.CanJoin)
            {
                await TestInsertUpdateDeleteEvents(database, salesDepartmentId, "SELECT e.id, e.name FROM employee e INNER JOIN department d ON e.department_id=d.id ORDER BY e.name", "name", "Joe Sales, Sr", 5, 1, 1, 1, new string[] { "id" });
                await TestInsertUpdateDeleteEvents(database, salesDepartmentId, "SELECT ec.employee_id, ec.contact_type, ec.contact_data, e.name FROM employee_contact ec INNER JOIN employee e ON ec.employee_id=e.id", "name", "Joe Sales, Sr", 8, 0, 0, 0, new string[] { "employee_id", "contact_type" });
                await TestMinimalSelects(database);
            }
        }
        public static async Task TestMinimalSelects(IDatabase database)
        {
            await DatabaseUnitTest.TruncateData(database);

            using (DynamicViewSet dynamicViewSet = new DynamicViewSet(database, listener: dataEventTransaction => {
            })) {
                DynamicView departmentDynamicView = dynamicViewSet.CreateDynamicView("department");
                DynamicView employeeDynamicView   = dynamicViewSet.CreateDynamicView("employee");
                await dynamicViewSet.StartAsync();

                await Task.Delay(200);

                int preSelectCount = database.SelectCount;
                await database.InsertAndCommitAsync <string>("employee", new {
                    name          = "Joe Sales",
                    department_id = 1,
                });

                await Task.Delay(200);

                // Should require doing two SELECTs to handle this INSERT (before and after SELECT)
                Assert.AreEqual(preSelectCount + 1, database.SelectCount);
            }
        }