public SetRoleVMSize ( |
||
paths | The service paths | |
roleName | string | The name of the role to change its vm size |
VMSize | string | The new role vm size |
리턴 | void |
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(Test.Utilities.Common.Data.NodeWebRoleScaffoldingPath, roleName, 1); Testing.AssertThrows<ArgumentException>(() => service.SetRoleVMSize(service.Paths, invalidRoleName, "Large"), string.Format(Resources.RoleNotFoundMessage, invalidRoleName)); } }
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, "Large"), string.Format(Resources.InvalidOrEmptyArgumentMessage, Resources.RoleName)); } }
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, "Medium"), string.Format(Resources.RoleNotFoundMessage, 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); }