public async Task GetProviderWithAliases() { var computeNamespace = "Microsoft.Compute"; var reg = await ProvidersOperations.RegisterAsync(computeNamespace); Assert.NotNull(reg); var result = await ProvidersOperations.ListAsync(expand : "resourceTypes/aliases").ToEnumerableAsync(); // Validate result Assert.True(result.Any()); var computeProvider = result.First( provider => string.Equals(provider.Namespace, computeNamespace, StringComparison.OrdinalIgnoreCase)); Assert.IsNotEmpty(computeProvider.ResourceTypes); var virtualMachinesType = computeProvider.ResourceTypes.First( resourceType => string.Equals(resourceType.ResourceType, "virtualMachines", StringComparison.OrdinalIgnoreCase)); Assert.IsNotEmpty(virtualMachinesType.Aliases); Assert.AreEqual("Microsoft.Compute/licenseType", virtualMachinesType.Aliases[0].Name); Assert.AreEqual("properties.licenseType", virtualMachinesType.Aliases[0].Paths[0].Path); computeProvider = (await ProvidersOperations.GetAsync(resourceProviderNamespace: computeNamespace, expand: "resourceTypes/aliases")).Value; Assert.IsNotEmpty(computeProvider.ResourceTypes); virtualMachinesType = computeProvider.ResourceTypes.First( resourceType => string.Equals(resourceType.ResourceType, "virtualMachines", StringComparison.OrdinalIgnoreCase)); Assert.IsNotEmpty(virtualMachinesType.Aliases); Assert.AreEqual("Microsoft.Compute/licenseType", virtualMachinesType.Aliases[0].Name); Assert.AreEqual("properties.licenseType", virtualMachinesType.Aliases[0].Paths[0].Path); }
public async Task VerifyProviderRegister() { await ProvidersOperations.RegisterAsync(ProviderName); var provider = (await ProvidersOperations.GetAsync(ProviderName)).Value; Assert.True(provider.RegistrationState == "Registered" || provider.RegistrationState == "Registering"); }
public async Task VerifyProviderUnregister() { var registerResult = await ProvidersOperations.RegisterAsync(ProviderName); var provider = (await ProvidersOperations.GetAsync(ProviderName)).Value; Assert.True(provider.RegistrationState == "Registered" || provider.RegistrationState == "Registering"); var unregisterResult = await ProvidersOperations.UnregisterAsync(ProviderName); provider = (await ProvidersOperations.GetAsync(ProviderName)).Value; Assert.True(provider.RegistrationState == "NotRegistered" || provider.RegistrationState == "Unregistering", "RegistrationState is expected NotRegistered or Unregistering. Actual value " + provider.RegistrationState); }
public async Task ProviderGetValidateMessage() { var reg = await ProvidersOperations.RegisterAsync(ProviderName); Assert.NotNull(reg); var result = (await ProvidersOperations.GetAsync(ProviderName)).Value; // Validate result Assert.NotNull(result); Assert.IsNotEmpty(result.Id); Assert.AreEqual(ProviderName, result.Namespace); Assert.True("Registered" == result.RegistrationState || "Registering" == result.RegistrationState, string.Format("Provider registration state was not 'Registered' or 'Registering', instead it was '{0}'", result.RegistrationState)); Assert.IsNotEmpty(result.ResourceTypes); Assert.IsNotEmpty(result.ResourceTypes[0].Locations); }
public async Task ProviderListValidateMessage() { var reg = await ProvidersOperations.RegisterAsync(ProviderName); Assert.NotNull(reg); var result = await ProvidersOperations.ListAsync(null).ToEnumerableAsync(); // Validate result Assert.True(result.Any()); var websiteProvider = result.First( p => p.Namespace.Equals(ProviderName, StringComparison.OrdinalIgnoreCase)); Assert.AreEqual(ProviderName, websiteProvider.Namespace); Assert.True("Registered" == websiteProvider.RegistrationState || "Registering" == websiteProvider.RegistrationState, string.Format("Provider registration state was not 'Registered' or 'Registering', instead it was '{0}'", websiteProvider.RegistrationState)); Assert.IsNotEmpty(websiteProvider.ResourceTypes); Assert.IsNotEmpty(websiteProvider.ResourceTypes[0].Locations); }