public static void AssertValidAfdSecret(FrontDoorSecretResource model, FrontDoorSecretResource getResult) { Assert.AreEqual(model.Data.Name, getResult.Data.Name); Assert.AreEqual(model.Data.Id, getResult.Data.Id); Assert.AreEqual(model.Data.ResourceType, getResult.Data.ResourceType); Assert.AreEqual(model.Data.ProvisioningState, getResult.Data.ProvisioningState); Assert.AreEqual(model.Data.DeploymentStatus, getResult.Data.DeploymentStatus); Assert.AreEqual(model.Data.Properties.SecretType, getResult.Data.Properties.SecretType); Assert.AreEqual(((CustomerCertificateProperties)model.Data.Properties).SecretVersion, ((CustomerCertificateProperties)getResult.Data.Properties).SecretVersion); Assert.AreEqual(((CustomerCertificateProperties)model.Data.Properties).CertificateAuthority, ((CustomerCertificateProperties)getResult.Data.Properties).CertificateAuthority); Assert.AreEqual(((CustomerCertificateProperties)model.Data.Properties).UseLatestVersion, ((CustomerCertificateProperties)getResult.Data.Properties).UseLatestVersion); Assert.AreEqual(((CustomerCertificateProperties)model.Data.Properties).SecretSource.Id.Name.ToString().ToLower(), ((CustomerCertificateProperties)getResult.Data.Properties).SecretSource.Id.Name.ToString().ToLower()); Assert.True(((CustomerCertificateProperties)model.Data.Properties).SubjectAlternativeNames.SequenceEqual(((CustomerCertificateProperties)getResult.Data.Properties).SubjectAlternativeNames)); }
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 afdSecretName = Recording.GenerateAssetName("AFDSecret-"); FrontDoorSecretResource afdSecret = await CreateAfdSecret(afdProfileResource, afdSecretName); Assert.AreEqual(afdSecretName, afdSecret.Data.Name); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorSecrets().CreateOrUpdateAsync(WaitUntil.Completed, null, afdSecret.Data)); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorSecrets().CreateOrUpdateAsync(WaitUntil.Completed, afdSecretName, null)); }
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 afdSecretName = Recording.GenerateAssetName("AFDSecret-"); FrontDoorSecretResource afdSecret = await CreateAfdSecret(afdProfileResource, afdSecretName); FrontDoorSecretResource getAfdSecret = await afdProfileResource.GetFrontDoorSecrets().GetAsync(afdSecretName); ResourceDataHelper.AssertValidAfdSecret(afdSecret, getAfdSecret); Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await afdProfileResource.GetFrontDoorSecrets().GetAsync(null)); }
public async Task Delete() { 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 afdSecretName = Recording.GenerateAssetName("AFDSecret-"); FrontDoorSecretResource afdSecret = await CreateAfdSecret(afdProfileResource, afdSecretName); await afdSecret.DeleteAsync(WaitUntil.Completed); var ex = Assert.ThrowsAsync <RequestFailedException>(async() => await afdSecret.GetAsync()); Assert.AreEqual(404, ex.Status); }