public void ManagedCache_ConversionWorksForPremiumSku()
 {
     CacheSkuCountConvert convert = new CacheSkuCountConvert(CacheServiceSkuType.Premium);
     Assert.Equal("5GB", convert.ToMemorySize(1));
     Assert.Equal("10GB", convert.ToMemorySize(2));
     Assert.Equal(1, convert.ToSkuCount("5GB"));
     Assert.Equal(30, convert.ToSkuCount("150GB"));
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("12MB"); });
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("-1"); });
 }
 public void ManagedCache_ConversionWorksForStandardSku()
 {
     CacheSkuCountConvert convert = new CacheSkuCountConvert(CacheServiceSkuType.Standard);
     Assert.Equal("1GB", convert.ToMemorySize(1));
     Assert.Equal("2GB", convert.ToMemorySize(2));
     Assert.Equal(1, convert.ToSkuCount("1GB"));
     Assert.Equal(10, convert.ToSkuCount("10GB"));
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("11"); });
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("foo-bar"); });
 }
 public void ManagedCache_ConversionWorksForBasicSku()
 {
     CacheSkuCountConvert convert = new CacheSkuCountConvert(CacheServiceSkuType.Basic);
     Assert.Equal("128MB", convert.ToMemorySize(1));
     Assert.Equal("256MB", convert.ToMemorySize(2));
     Assert.Equal(2, convert.ToSkuCount("256"));
     Assert.Equal(1, convert.ToSkuCount("128MB"));
     Assert.Equal(1, convert.ToSkuCount("128mb"));
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("2222"); });
     Assert.Throws(typeof(ArgumentException), () => { convert.ToSkuCount("foo-bar"); });
 }
 public PSCacheService(CloudServiceResource resource)
 {
     Name = resource.Name;
     State = resource.SubState;
     Location = resource.IntrinsicSettingsSection.CacheServiceInputSection.Location;
     Sku = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuType;
     int skuCount = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuCount;
     CacheSkuCountConvert convert = new CacheSkuCountConvert(Sku);
     Memory = convert.ToMemorySize(skuCount);
 }
Example #5
0
        public PSCacheService(CloudServiceResource resource)
        {
            Name     = resource.Name;
            State    = resource.SubState;
            Location = resource.IntrinsicSettingsSection.CacheServiceInputSection.Location;
            Sku      = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuType;
            int skuCount = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuCount;
            CacheSkuCountConvert convert = new CacheSkuCountConvert(Sku);

            Memory = convert.ToMemorySize(skuCount);
        }
 public PSCacheServiceWithNamedCaches(CloudServiceResource resource)
 {
     Name = resource.Name;
     State = resource.SubState;
     Location = resource.IntrinsicSettingsSection.CacheServiceInputSection.Location;
     Sku = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuType;
     int skuCount = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuCount;
     CacheSkuCountConvert convert = new CacheSkuCountConvert(Sku);
     Memory = convert.ToMemorySize(skuCount);
     NamedCaches = new List<PSNamedCachesAttributes>();
     foreach (IntrinsicSettings.CacheServiceInput.NamedCache namedCache in resource.IntrinsicSettingsSection.CacheServiceInputSection.NamedCaches)
     {
         NamedCaches.Add(new PSNamedCachesAttributes(namedCache));
     }
 }
        public PSCacheServiceWithNamedCaches(CloudServiceResource resource)
        {
            Name     = resource.Name;
            State    = resource.SubState;
            Location = resource.IntrinsicSettingsSection.CacheServiceInputSection.Location;
            Sku      = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuType;
            int skuCount = resource.IntrinsicSettingsSection.CacheServiceInputSection.SkuCount;
            CacheSkuCountConvert convert = new CacheSkuCountConvert(Sku);

            Memory      = convert.ToMemorySize(skuCount);
            NamedCaches = new List <PSNamedCachesAttributes>();
            foreach (IntrinsicSettings.CacheServiceInput.NamedCache namedCache in resource.IntrinsicSettingsSection.CacheServiceInputSection.NamedCaches)
            {
                NamedCaches.Add(new PSNamedCachesAttributes(namedCache));
            }
        }