private object GetPowerAppsEnvironmentLocationsAsync(OperationRunner context)
        {
            context.Logger.LogInformation("Getting PowerApps environments...");

            PowerAppsClient client = new PowerAppsClient(WizardContext.TokenProvider);

            client.SetLogger(context.Logger);

            return(client.GetEnvironmentLocationsAsync().Result);
        }
        public void GetEnvironmentLocationsAsyncSuccess()
        {
            string expectedRequestUri = "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/locations?api-version=2016-11-01";
            Dictionary <string, string> expectedLocations = new Dictionary <string, string>()
            {
                { "name1", "unitedstates" },
                { "displayName1", "United States" },
                { "code1", "NA" },
                { "name2", "europe" },
                { "displayName2", "Europe" },
                { "code2", "EMEA" },
                { "name3", "asia" },
                { "displayName3", "Asia" },
                { "code3", "APAC" },
            };
            string responseFilePath = @"./data/templates/responses/powerApps/getLocations.json";

            HttpRequestMessage expectedRequest = TestHelper.CreateHttpRequest(
                HttpMethod.Get,
                expectedRequestUri);

            _httpClient.RegisterExpectedRequest(new ExpectedRequest(expectedRequest));

            HttpResponseMessage expectedResponse = TestHelper.CreateHttpResponse(
                HttpStatusCode.OK,
                null,
                responseFilePath,
                "application/json",
                expectedLocations);

            _httpClient.RegisterExpectedResponse(
                expectedRequestUri,
                new ExpectedResponse(expectedResponse));

            IPowerAppsClient client = new PowerAppsClient(_tokenProvider);

            GetPowerAppsEnvironmentLocationsResponse response = client.GetEnvironmentLocationsAsync().Result;

            Assert.IsNotNull(response, "The response should not be null!");
            Assert.IsNotNull(response.Value, "The response Value member should not be null!");
            Assert.AreEqual(3, response.Value.Length, $"Unexpected number of locations ('3' != '{response.Value.Length}')!");
            Assert.AreEqual(expectedLocations["name1"], response.Value[0].Name, $"Unexpected name for location 1 ('{expectedLocations["name1"]}' != '{response.Value[0].Name}')");
            Assert.IsNotNull(response.Value[0].Properties, "The response Value Properties member should not be null for location 1!");
            Assert.AreEqual(expectedLocations["code1"], response.Value[0].Properties.Code, $"Unexpected name for location 1 ('{expectedLocations["code1"]}' != '{response.Value[0].Name}')");
            Assert.AreEqual(expectedLocations["displayName1"], response.Value[0].Properties.DisplayName, $"Unexpected display name for location 1 ('{expectedLocations["displayName1"]}' != '{response.Value[0].Properties.DisplayName}')");
            Assert.AreEqual(expectedLocations["name2"], response.Value[1].Name, $"Unexpected name for location 2 ('{expectedLocations["name2"]}' != '{response.Value[1].Name}')");
            Assert.IsNotNull(response.Value[1].Properties, "The response Value Properties member should not be null for location 2!");
            Assert.AreEqual(expectedLocations["code2"], response.Value[1].Properties.Code, $"Unexpected name for location 2 ('{expectedLocations["code2"]}' != '{response.Value[1].Name}')");
            Assert.AreEqual(expectedLocations["displayName2"], response.Value[1].Properties.DisplayName, $"Unexpected display name for location 2 ('{expectedLocations["displayName2"]}' != '{response.Value[1].Properties.DisplayName}')");
            Assert.AreEqual(expectedLocations["name3"], response.Value[2].Name, $"Unexpected name for location 3 ('{expectedLocations["name3"]}' != '{response.Value[2].Name}')");
            Assert.IsNotNull(response.Value[2].Properties, "The response Value Properties member should not be null for location 3!");
            Assert.AreEqual(expectedLocations["code3"], response.Value[2].Properties.Code, $"Unexpected name for location 3 ('{expectedLocations["code3"]}' != '{response.Value[2].Name}')");
            Assert.AreEqual(expectedLocations["displayName3"], response.Value[2].Properties.DisplayName, $"Unexpected display name for location 3 ('{expectedLocations["displayName3"]}' != '{response.Value[2].Properties.DisplayName}')");
        }