public async Task UserDefinedFunctionsIteratorTest() { 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; UserDefinedFunctionProperties cosmosUserDefinedFunction = await this.CreateRandomUdf(); HashSet <string> settings = new HashSet <string>(); FeedIterator <UserDefinedFunctionProperties> iter = scripts.GetUserDefinedFunctionQueryIterator <UserDefinedFunctionProperties>();; while (iter.HasMoreResults) { foreach (UserDefinedFunctionProperties storedProcedureSettingsEntry in await iter.ReadNextAsync()) { settings.Add(storedProcedureSettingsEntry.Id); } } Assert.IsTrue(settings.Contains(cosmosUserDefinedFunction.Id), "The iterator did not return the user defined function definition."); // Delete existing user defined functions. await scripts.DeleteUserDefinedFunctionAsync(cosmosUserDefinedFunction.Id); } }
public async Task DeleteUDF(string udfName) { string message = "Delete UserDefinedFunction"; Printer.PrintLine(message: message); Scripts scripts = _container.Scripts; UserDefinedFunctionResponse udfResponse = await scripts.DeleteUserDefinedFunctionAsync(udfName); WriteLine($"{udfName} -- UDF Deleted"); Printer.PrintLine(noOfTimes: (100 + message.Length)); }