public void InitializeAllFieldsFromResponseObject() { //Arrange string testState = "Started"; string testSubState = "Active"; string testName = "Dummy"; string testLocation = "West US"; CacheServiceSkuType testSku = CacheServiceSkuType.Premium; int testSkuCount = 2; //This will be mapped to 10GB display value string expectedMemoryInfo = "10GB"; CloudServiceResource resource = new CloudServiceResource(); resource.State = testState; resource.SubState = testSubState; resource.Name = testName; IntrinsicSettings intrinsic = new IntrinsicSettings(); IntrinsicSettings.CacheServiceInput cacheInput = new IntrinsicSettings.CacheServiceInput(); intrinsic.CacheServiceInputSection = cacheInput; resource.IntrinsicSettingsSection = intrinsic; cacheInput.Location = testLocation; cacheInput.SkuCount = testSkuCount; cacheInput.SkuType = testSku; //Act PSCacheService service = new PSCacheService(resource); //Assert Assert.Equal(testSubState, service.State); Assert.Equal(testName, service.Name); Assert.Equal(testLocation, service.Location); Assert.Equal(expectedMemoryInfo, service.Memory); Assert.Equal(testSku, service.Sku); }
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)); } }