public static IEnumerable <FlavorDetails> ListAllFlavorsWithDetails(IComputeProvider provider, int?blockSize = null, int?minDiskInGB = null, int?minRamInMB = null, string region = null, CloudIdentity identity = null) { if (blockSize <= 0) { throw new ArgumentOutOfRangeException("blockSize"); } FlavorDetails lastFlavor = null; do { string marker = lastFlavor != null ? lastFlavor.Id : null; IEnumerable <FlavorDetails> flavors = provider.ListFlavorsWithDetails(minDiskInGB, minRamInMB, marker, blockSize, region, identity); lastFlavor = null; foreach (FlavorDetails flavor in flavors) { lastFlavor = flavor; yield return(flavor); } } while (lastFlavor != null); }
public void TestGetFlavor() { IComputeProvider provider = Bootstrapper.CreateComputeProvider(); IEnumerable <FlavorDetails> flavors = ListAllFlavorsWithDetails(provider); Assert.IsNotNull(flavors); if (!flavors.Any()) { Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured flavors."); } foreach (FlavorDetails flavor in flavors) { Assert.IsNotNull(flavor); FlavorDetails details = provider.GetFlavor(flavor.Id); Assert.AreEqual(flavor.Disabled, details.Disabled); Assert.AreEqual(flavor.DiskSizeInGB, details.DiskSizeInGB); Assert.AreEqual(flavor.Id, details.Id); //Assert.AreEqual(flavor.Links, details.Links); Assert.AreEqual(flavor.Name, details.Name); Assert.AreEqual(flavor.RAMInMB, details.RAMInMB); Assert.AreEqual(flavor.VirtualCPUCount, details.VirtualCPUCount); } }