示例#1
0
        public void SetAzureVMSizeProcessTestsPHPRoleNameDoesNotExistServiceContainsWebRoleFail()
        {
            string roleName        = "WebRole1";
            string invalidRoleName = "foo";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                service.AddWebRole(Test.Utilities.Common.Data.PHPWebRoleScaffoldingPath, roleName, 1);
                Testing.AssertThrows <ArgumentException>(() => service.SetRoleVMSize(service.Paths, invalidRoleName, "Large"), string.Format(Resources.RoleNotFoundMessage, invalidRoleName));
            }
        }
        public void SetAzureVMSizeProcessTestsNodeRoleNameDoesNotExistServiceContainsWorkerRoleFail()
        {
            string roleName        = "WorkerRole1";
            string invalidRoleName = "foo";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath, roleName, 1);
                Testing.AssertThrows <ArgumentException>(() => service.SetRoleVMSize(service.Paths, invalidRoleName, RoleSize.Large.ToString()), string.Format(Resources.RoleNotFoundMessage, invalidRoleName));
            }
        }
示例#3
0
        /// <summary>
        /// Sets the VM size of the role.
        /// </summary>
        /// <param name="roleName">The role name</param>
        /// <param name="vmSize">The vm size</param>
        /// <param name="rootPath">The service root path</param>
        /// <returns>Role after updating VM size</returns>
        public RoleSettings SetAzureVMSizeProcess(string roleName, string vmSize, string rootPath)
        {
            CloudServiceProject service = new CloudServiceProject(rootPath, null);

            service.SetRoleVMSize(service.Paths, roleName, vmSize);

            if (PassThru)
            {
                SafeWriteOutputPSObject(typeof(RoleSettings).FullName, Parameters.RoleName, roleName);
            }

            return(service.Components.GetCloudConfigRole(roleName));
        }
        public void SetAzureVMSizeProcessTestsNodeRoleNameDoesNotExistServiceContainsWebRoleFail()
        {
            string roleName = "WebRole1";
            string invalidRoleName = "foo";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                service.AddWebRole(Data.NodeWebRoleScaffoldingPath, roleName, 1);
                Testing.AssertThrows<ArgumentException>(() => service.SetRoleVMSize(service.Paths, invalidRoleName, RoleSize.Large.ToString()), string.Format(Resources.RoleNotFoundMessage, invalidRoleName));
            }
        }
        public void SetAzureVMSizeProcessTestsRoleNameDoesNotExistFail()
        {
            string roleName = "WebRole1";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                Testing.AssertThrows<ArgumentException>(() => service.SetRoleVMSize(service.Paths, roleName, RoleSize.Medium.ToString()), string.Format(Resources.RoleNotFoundMessage, roleName));
            }
        }
        public void SetAzureVMSizeProcessNegativeRoleInstanceFail()
        {
            string roleName = "WebRole1";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
                Testing.AssertThrows<ArgumentException>(() => service.SetRoleVMSize(service.Paths, roleName, string.Empty), string.Format(Resources.InvalidVMSize, roleName));
            }
        }
 public void SetAzureVMSizeProcessTestsNullRoleNameFail()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
         Testing.AssertThrows<ArgumentException>(() => service.SetRoleVMSize(service.Paths, null, RoleSize.Large.ToString()), string.Format(Resources.InvalidOrEmptyArgumentMessage, Resources.RoleName));
     }
 }
        /// <summary>
        /// Sets the VM size of the role.
        /// </summary>
        /// <param name="roleName">The role name</param>
        /// <param name="vmSize">The vm size</param>
        /// <param name="rootPath">The service root path</param>
        /// <returns>Role after updating VM size</returns>
        public RoleSettings SetAzureVMSizeProcess(string roleName, string vmSize, string rootPath)
        {
            CloudServiceProject service = new CloudServiceProject(rootPath, null);
            service.SetRoleVMSize(service.Paths, roleName, vmSize);

            if (PassThru)
            {
                SafeWriteOutputPSObject(typeof(RoleSettings).FullName, Parameters.RoleName, roleName);
            }

            return service.Components.GetCloudConfigRole(roleName);
        }