public void DisableRemoteDesktopForEmptyService() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); disableRDCmdlet.DisableRemoteDesktop(); } }
public void DisableRemoteDesktopForWebAndWorkerRoles() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); string rootPath = files.CreateNewService("NEW_SERVICE"); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole" }; addNodeWebCmdlet.ExecuteCmdlet(); addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole" }; addNodeWorkerCmdlet.ExecuteCmdlet(); disableRDCmdlet.DisableRemoteDesktop(); } }
public void TestCreatePackageSuccessfull() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); string rootPath = Path.Combine(files.RootPath, "NEW_SERVICE"); string packagePath = Path.Combine(rootPath, Resources.CloudPackageFileName); AzureService service = new AzureService(rootPath, null); service.AddWebRole(Data.NodeWebRoleScaffoldingPath); cmdlet.ExecuteCmdlet(); PSObject obj = mockCommandRuntime.OutputPipeline[0] as PSObject; Assert.AreEqual<string>(string.Format(Resources.PackageCreated, packagePath), mockCommandRuntime.VerboseStream[0]); Assert.AreEqual<string>(packagePath, obj.GetVariableValue<string>(Parameters.PackagePath)); Assert.IsTrue(File.Exists(packagePath)); } }
public void DisableRemoteDesktopForWebRole() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); string rootPath = files.CreateNewService("NEW_SERVICE"); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole" }; addNodeWebCmdlet.ExecuteCmdlet(); disableRDCmdlet.PassThru = true; disableRDCmdlet.DisableRemoteDesktop(); Assert.IsTrue((bool)mockCommandRuntime.OutputPipeline[1]); } }
public void EnableDisableRemoteDesktopForWebRole() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); string rootPath = files.CreateNewService("NEW_SERVICE"); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole" }; addNodeWebCmdlet.ExecuteCmdlet(); EnableAzureRemoteDesktopCommandTest.EnableRemoteDesktop("user", "GoodPassword!"); disableRDCmdlet.DisableRemoteDesktop(); // Verify the role has been setup with forwarding, access, // and certs AzureService service = new AzureService(rootPath, null); EnableAzureRemoteDesktopCommandTest.VerifyWebRole(service.Components.Definition.WebRole[0], true); VerifyDisableRoleSettings(service); } }
public void EnableRemoteDesktopForWebAndWorkerRoles() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); string rootPath = files.CreateNewService("NEW_SERVICE"); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole", Instances = 1 }; addNodeWebCmdlet.ExecuteCmdlet(); addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole", Instances = 1 }; addNodeWorkerCmdlet.ExecuteCmdlet(); mockCommandRuntime.ResetPipelines(); EnableRemoteDesktop("user", "GoodPassword!"); // Verify the roles have been setup with forwarding, access, // and certs AzureService service = new AzureService(rootPath, null); VerifyWebRole(service.Components.Definition.WebRole[0], false); VerifyWorkerRole(service.Components.Definition.WorkerRole[0], true); VerifyRoleSettings(service); Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count); } }
public void EnableRemoteDesktopForEmptyService() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); ManagementTesting.AssertThrows<InvalidOperationException>(() => EnableRemoteDesktop("user", "GoodPassword!")); } }
public void EnableRemoteDesktopBasicParameterValidation() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop(null, null)); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop(string.Empty, string.Empty)); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", null)); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", string.Empty)); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", "short")); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", "onlylower")); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", "ONLYUPPER")); ManagementTesting.AssertThrows<ArgumentException>( () => EnableRemoteDesktop("user", "1234567890")); } }