public async Task GetLogAnalyticsLocations() { Subscription subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroup rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); Profile afdProfile = await CreateAfdProfile(rg, afdProfileName, SkuName.StandardAzureFrontDoor); ContinentsResponse continentsResponse = await afdProfile.GetLogAnalyticsLocationsAfdProfileAsync(); Assert.AreEqual(continentsResponse.Continents.Count, 7); }
public void GetLogAnalyticsLocationsTest() { var handler1 = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; var handler2 = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK }; using (MockContext context = MockContext.Start(this.GetType())) { // Create clients var cdnMgmtClient = CdnTestUtilities.GetCdnManagementClient(context, handler1); var resourcesClient = CdnTestUtilities.GetResourceManagementClient(context, handler2); // Create resource group var resourceGroupName = CdnTestUtilities.CreateResourceGroup(resourcesClient); try { // Create a standard Azure frontdoor profile string profileName = TestUtilities.GenerateName("profile"); Profile createParameters = new Profile { Location = "WestUs", Sku = new Sku { Name = SkuName.StandardAzureFrontDoor }, Tags = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } } }; var profile = cdnMgmtClient.Profiles.Create(resourceGroupName, profileName, createParameters); // Create a standard Azure frontdoor endpoint string endpointName = TestUtilities.GenerateName("endpointName"); var endpointCreateParameters = new AFDEndpoint("WestUs") { EnabledState = "Enabled", OriginResponseTimeoutSeconds = 60, Tags = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } } }; var endpoint = cdnMgmtClient.AFDEndpoints.Create(resourceGroupName, profileName, endpointName, endpointCreateParameters); ContinentsResponse response = cdnMgmtClient.LogAnalytics.GetLogAnalyticsLocations(resourceGroupName, profileName); Assert.NotNull(response); Assert.NotEmpty(response.Continents); Assert.NotEmpty(response.CountryOrRegions); } finally { // Delete resource group _ = CdnTestUtilities.DeleteResourceGroupAsync(resourcesClient, resourceGroupName); } } }