Ejemplo n.º 1
0
        public async Task GetFunctionKeyTest(string key, string value)
        {
            try
            {
                const string functionName = "function1";
                var          mockUrl      = $"{managementUrl}{appId}/functions/{functionName}/listKeys?api-version={ArmUriTemplates.WebsitesApiVersion}";

                var mockHttp = new MockHttpMessageHandler();
                mockHttp.When(HttpMethod.Post, mockUrl)
                .Respond("application/json", $"{{'{key}': '{value}'}}");

                ArmClient.SetTestHandler(mockHttp);

                var result = await AzureHelper.GetFunctionKey(functionName, appId, accessToken, managementUrl);

                result.Should().Be(value);
            }
            finally
            {
                ArmClient.SetTestHandler(null);
            }
        }