コード例 #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));
            }
        }
コード例 #2
0
        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));
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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));
            }
        }
コード例 #6
0
        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));
            }
        }
コード例 #7
0
 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));
     }
 }
コード例 #8
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);
        }