Пример #1
0
 private async Task CleanUpVirtualNetwork()
 {
     if (virtualNetwork != null)
     {
         await virtualNetwork.DeleteAsync(WaitUntil.Completed);
     }
     if (privateDnsZone != null)
     {
         await privateDnsZone.DeleteAsync(WaitUntil.Completed);
     }
     if (storageAccount != null)
     {
         //await StorageManagementClient.StorageAccounts.DeleteAsync(resourceGroup.Data.Name, storageAccount.Name);
         await storageAccount.DeleteAsync(WaitUntil.Completed);
     }
 }
Пример #2
0
        public async Task StartDelete()
        {
            var             rgOp     = await(await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false)).GetResourceGroups().Construct(Location.WestUS2).CreateOrUpdateAsync(Recording.GenerateAssetName("testrg"));
            ResourceGroup   rg       = rgOp.Value;
            var             createOp = InstrumentOperation(await StartCreateGenericAvailabilitySetAsync(rg.Id));
            GenericResource aset     = await createOp.WaitForCompletionAsync();

            Assert.DoesNotThrowAsync(async() =>
            {
                var deleteOp = await aset.DeleteAsync(false);
                _            = await deleteOp.WaitForCompletionResponseAsync();
            });

            var fakeId = $"/subscriptions/{TestEnvironment.SubscriptionId}/resourceGroups/foo-1";

            Assert.ThrowsAsync <RequestFailedException>(async() =>
            {
                var createOp = await StartCreateGenericAvailabilitySetAsync(new ResourceIdentifier(fakeId));
                _            = await createOp.WaitForCompletionAsync();
            });
        }