Ejemplo n.º 1
0
        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 override void ExecuteCmdlet()
 {
     CacheClient.ProgressRecorder = (message) => { WriteVerbose(message); };
     string memory = memoryDynamicParameterSet.GetMemoryValue(Sku);
     PSCacheService cacheService = new PSCacheService(
         CacheClient.UpdateCacheService(Name, Sku, memory, ConfirmAction, Force.IsPresent));
     WriteObject(cacheService);
 }
        public override void ExecuteCmdlet()
        {
            WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");

            CacheClient.ProgressRecorder = (message) => { WriteVerbose(message); };
            string memory = memoryDynamicParameterSet.GetMemoryValue(Sku);
            PSCacheService cacheService = new PSCacheService(
                CacheClient.UpdateCacheService(Name, Sku, memory, ConfirmAction, Force.IsPresent));
            WriteObject(cacheService);
        }
        public override void ExecuteCmdlet()
        {
            cacheServiceName = CacheClient.NormalizeCacheServiceName(Name);

            CacheClient.ProgressRecorder = (p) => { WriteVerbose(p); };

            string memory = memoryDynamicParameterSet.GetMemoryValue(Sku);

            PSCacheService cacheService = new PSCacheService(CacheClient.CreateCacheService(
                CurrentContext.Subscription.Id.ToString(),
                cacheServiceName,
                Location,
                Sku,
                memory));

            WriteObject(cacheService);
        }
        public override void ExecuteCmdlet()
        {
            WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");

            cacheServiceName = CacheClient.NormalizeCacheServiceName(Name);

            CacheClient.ProgressRecorder = (p) => { WriteVerbose(p); };

            string memory = memoryDynamicParameterSet.GetMemoryValue(Sku);

            PSCacheService cacheService = new PSCacheService(CacheClient.CreateCacheService(
                Profile.Context.Subscription.Id.ToString(),
                cacheServiceName,
                Location,
                Sku,
                memory));

            WriteObject(cacheService);
        }