public async Task TriggersIteratorTest() { using (CosmosClient cosmosClient = TestCommon.CreateCosmosClient(new CosmosClientOptions() { Serializer = new FaultySerializer() })) { // Should not use the custom serializer for these operations Scripts scripts = cosmosClient.GetContainer(this.database.Id, this.container.Id).Scripts; TriggerProperties cosmosTrigger = await this.CreateRandomTrigger(); HashSet <string> settings = new HashSet <string>(); FeedIterator <TriggerProperties> iter = scripts.GetTriggerQueryIterator <TriggerProperties>();; while (iter.HasMoreResults) { foreach (TriggerProperties storedProcedureSettingsEntry in await iter.ReadNextAsync()) { settings.Add(storedProcedureSettingsEntry.Id); } } Assert.IsTrue(settings.Contains(cosmosTrigger.Id), "The iterator did not return the user defined function definition."); // Delete existing trigger await scripts.DeleteTriggerAsync(cosmosTrigger.Id); } }
public async Task DeleteTrigger(string triggerName) { string message = "Delete Triggers"; Printer.PrintLine(message: message); Scripts scripts = _container.Scripts; TriggerResponse triggerResponse = await scripts.DeleteTriggerAsync(triggerName); WriteLine($"Delete Trigger, Deleted Trigger with Id: {triggerName}"); Printer.PrintLine(noOfTimes: (100 + message.Length)); }