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 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); }