public async Task Get()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-3-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroupResource rg = lro.Value;
            string                      templateSpecName        = Recording.GenerateAssetName("templateSpec-G-");
            TemplateSpecData            templateSpecData        = CreateTemplateSpecData(templateSpecName);
            TemplateSpecResource        templateSpec            = (await rg.GetTemplateSpecs().CreateOrUpdateAsync(WaitUntil.Completed, templateSpecName, templateSpecData)).Value;
            const string                version                 = "v1";
            TemplateSpecVersionData     templateSpecVersionData = CreateTemplateSpecVersionData();
            TemplateSpecVersionResource templateSpecVersion     = (await templateSpec.GetTemplateSpecVersions().CreateOrUpdateAsync(WaitUntil.Completed, version, templateSpecVersionData)).Value;
            TemplateSpecVersionResource getTemplateSpecVersion  = await templateSpec.GetTemplateSpecVersions().GetAsync(version);

            AssertValidTemplateSpecVersion(templateSpecVersion, getTemplateSpecVersion);
            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await templateSpec.GetTemplateSpecVersions().GetAsync(null));
        }
        public async Task List()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-2-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroupResource rg = lro.Value;
            string                  templateSpecName        = Recording.GenerateAssetName("templateSpec-L-");
            TemplateSpecData        templateSpecData        = CreateTemplateSpecData(templateSpecName);
            TemplateSpecResource    templateSpec            = (await rg.GetTemplateSpecs().CreateOrUpdateAsync(WaitUntil.Completed, templateSpecName, templateSpecData)).Value;
            const string            version                 = "v1";
            TemplateSpecVersionData templateSpecVersionData = CreateTemplateSpecVersionData();

            _ = (await templateSpec.GetTemplateSpecVersions().CreateOrUpdateAsync(WaitUntil.Completed, version, templateSpecVersionData)).Value;
            int count = 0;

            await foreach (var tempTemplateSpecVersion in templateSpec.GetTemplateSpecVersions().GetAllAsync())
            {
                count++;
            }
            Assert.AreEqual(count, 1);
        }
        public async Task Delete()
        {
            SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync();

            string            rgName = Recording.GenerateAssetName("testRg-1-");
            ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2);
            var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData);

            ResourceGroupResource rg = lro.Value;
            string                      templateSpecName        = Recording.GenerateAssetName("templateSpec-C-");
            TemplateSpecData            templateSpecData        = CreateTemplateSpecData(templateSpecName);
            TemplateSpecResource        templateSpec            = (await rg.GetTemplateSpecs().CreateOrUpdateAsync(WaitUntil.Completed, templateSpecName, templateSpecData)).Value;
            const string                version                 = "v1";
            TemplateSpecVersionData     templateSpecVersionData = CreateTemplateSpecVersionData();
            TemplateSpecVersionResource templateSpecVersion     = (await templateSpec.GetTemplateSpecVersions().CreateOrUpdateAsync(WaitUntil.Completed, version, templateSpecVersionData)).Value;
            await templateSpecVersion.DeleteAsync(WaitUntil.Completed);

            var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await templateSpecVersion.GetAsync());

            Assert.AreEqual(404, ex.Status);
        }