public async Task CRUDTest()
        {
            UserDefinedFunctionProperties settings = new UserDefinedFunctionProperties
            {
                Id   = Guid.NewGuid().ToString(),
                Body = UserDefinedFunctionsTests.function,
            };

            UserDefinedFunctionResponse response =
                await this.scripts.CreateUserDefinedFunctionAsync(settings);

            double reqeustCharge = response.RequestCharge;

            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.IsNotNull(response.Diagnostics);
            string diagnostics = response.Diagnostics.ToString();

            Assert.IsFalse(string.IsNullOrEmpty(diagnostics));
            Assert.IsTrue(diagnostics.Contains("StatusCode"));
            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(settings, response);

            response = await this.scripts.ReadUserDefinedFunctionAsync(settings.Id);

            reqeustCharge = response.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Diagnostics);
            diagnostics = response.Diagnostics.ToString();
            Assert.IsFalse(string.IsNullOrEmpty(diagnostics));
            Assert.IsTrue(diagnostics.Contains("StatusCode"));
            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(settings, response);

            UserDefinedFunctionProperties updatedSettings = response.Resource;

            updatedSettings.Body = @"function(amt) { return amt * 0.42; }";

            UserDefinedFunctionResponse replaceResponse = await this.scripts.ReplaceUserDefinedFunctionAsync(updatedSettings);

            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(updatedSettings, replaceResponse);
            reqeustCharge = replaceResponse.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.IsNotNull(replaceResponse.Diagnostics);
            diagnostics = replaceResponse.Diagnostics.ToString();
            Assert.IsFalse(string.IsNullOrEmpty(diagnostics));
            Assert.IsTrue(diagnostics.Contains("StatusCode"));
            Assert.AreEqual(HttpStatusCode.OK, replaceResponse.StatusCode);

            replaceResponse = await this.scripts.DeleteUserDefinedFunctionAsync(settings.Id);

            reqeustCharge = replaceResponse.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.IsNotNull(replaceResponse.Diagnostics);
            diagnostics = replaceResponse.Diagnostics.ToString();
            Assert.IsFalse(string.IsNullOrEmpty(diagnostics));
            Assert.IsTrue(diagnostics.Contains("StatusCode"));
            Assert.AreEqual(HttpStatusCode.NoContent, replaceResponse.StatusCode);
        }
        public async Task CRUDTest()
        {
            CosmosUserDefinedFunctionSettings settings = new CosmosUserDefinedFunctionSettings
            {
                Id   = Guid.NewGuid().ToString(),
                Body = UserDefinedFunctionsTests.function,
            };

            UserDefinedFunctionResponse response =
                await this.scripts.CreateUserDefinedFunctionAsync(settings);

            double reqeustCharge = response.RequestCharge;

            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(settings, response);

            response = await this.scripts.ReadUserDefinedFunctionAsync(settings.Id);

            reqeustCharge = response.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(settings, response);

            CosmosUserDefinedFunctionSettings updatedSettings = response.Resource;

            updatedSettings.Body = @"function(amt) { return amt * 0.42; }";

            UserDefinedFunctionResponse replaceResponse = await this.scripts.ReplaceUserDefinedFunctionAsync(updatedSettings);

            UserDefinedFunctionsTests.ValidateUserDefinedFunctionSettings(updatedSettings, replaceResponse);
            reqeustCharge = replaceResponse.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.OK, replaceResponse.StatusCode);

            replaceResponse = await this.scripts.DeleteUserDefinedFunctionAsync(settings.Id);

            reqeustCharge = replaceResponse.RequestCharge;
            Assert.IsTrue(reqeustCharge > 0);
            Assert.AreEqual(HttpStatusCode.NoContent, replaceResponse.StatusCode);
        }