public async Task CreateOrUpdate() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); FrontDoorEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); Assert.AreEqual(afdEndpointName, afdEndpointInstance.Data.Name); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorEndpoints().CreateOrUpdateAsync(WaitUntil.Completed, null, afdEndpointInstance.Data)); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorEndpoints().CreateOrUpdateAsync(WaitUntil.Completed, afdEndpointName, null)); }
protected async Task <FrontDoorEndpointResource> CreateAfdEndpoint(ProfileResource profile, string endpointName) { FrontDoorEndpointData input = ResourceDataHelper.CreateAfdEndpointData(); var lro = await profile.GetFrontDoorEndpoints().CreateOrUpdateAsync(WaitUntil.Completed, endpointName, input); return(lro.Value); }
public async Task Get() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); FrontDoorEndpointResource afdEndpointInstance = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); FrontDoorEndpointResource getAfdEndpointInstance = await afdProfileResource.GetFrontDoorEndpoints().GetAsync(afdEndpointName); ResourceDataHelper.AssertValidAfdEndpoint(afdEndpointInstance, getAfdEndpointInstance); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorEndpoints().GetAsync(null)); }
public async Task List() { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string afdProfileName = Recording.GenerateAssetName("AFDProfile-"); ProfileResource afdProfileResource = await CreateAfdProfile(rg, afdProfileName, CdnSkuName.StandardAzureFrontDoor); string afdEndpointName = Recording.GenerateAssetName("AFDEndpoint-"); _ = await CreateAfdEndpoint(afdProfileResource, afdEndpointName); int count = 0; await foreach (var tempAFDEndpoint in afdProfileResource.GetFrontDoorEndpoints().GetAllAsync()) { count++; } Assert.AreEqual(count, 1); }