public async Task Trigger_Drop_All() { var dbName = HelperDatabase.GetRandomName("tcp_lo_"); await HelperDatabase.CreateDatabaseAsync(ProviderType.Sql, dbName, true); var cs = HelperDatabase.GetConnectionString(ProviderType.Sql, dbName); var sqlProvider = new SqlSyncProvider(cs); // Create default table var ctx = new AdventureWorksContext((dbName, ProviderType.Sql, sqlProvider), true, false); await ctx.Database.EnsureCreatedAsync(); var options = new SyncOptions(); var setup = new SyncSetup(new string[] { "SalesLT.Product" }); var localOrchestrator = new LocalOrchestrator(sqlProvider, options, setup); var onCreating = 0; var onCreated = 0; var onDropping = 0; var onDropped = 0; localOrchestrator.OnTriggerCreating(tca => onCreating++); localOrchestrator.OnTriggerCreated(tca => onCreated++); localOrchestrator.OnTriggerDropping(tca => onDropping++); localOrchestrator.OnTriggerDropped(tca => onDropped++); var isCreated = await localOrchestrator.CreateTriggersAsync(setup.Tables["Product", "SalesLT"]); Assert.True(isCreated); Assert.Equal(3, onCreating); Assert.Equal(3, onCreated); Assert.Equal(0, onDropping); Assert.Equal(0, onDropped); onCreating = 0; onCreated = 0; onDropping = 0; onDropped = 0; var isDropped = await localOrchestrator.DropTriggersAsync(setup.Tables["Product", "SalesLT"]); Assert.True(isCreated); Assert.Equal(0, onCreating); Assert.Equal(0, onCreated); Assert.Equal(3, onDropping); Assert.Equal(3, onDropped); HelperDatabase.DropDatabase(ProviderType.Sql, dbName); }