public void AddNewCacheWorkerRoleSuccessful() { using (FileSystemHelper files = new FileSystemHelper(this)) { string rootPath = Path.Combine(files.RootPath, "AzureService"); string roleName = "WorkerRole"; int expectedInstanceCount = 10; newServiceCmdlet.NewAzureServiceProcess(files.RootPath, "AzureService"); WorkerRole cacheWorkerRole = addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(roleName, expectedInstanceCount, rootPath); AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, "AzureService", "WorkerRole"), Path.Combine(Resources.GeneralScaffolding, Resources.WorkerRole)); AzureAssert.WorkerRoleImportsExists(new Import { moduleName = Resources.CachingModuleName }, cacheWorkerRole); AzureAssert.LocalResourcesLocalStoreExists(new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }, cacheWorkerRole.LocalResources); Assert.IsNull(cacheWorkerRole.Endpoints.InputEndpoint); AssertConfigExists(Testing.GetCloudRole(rootPath, roleName)); AssertConfigExists(Testing.GetLocalRole(rootPath, roleName), Resources.EmulatorConnectionString); PSObject actualOutput = mockCommandRuntime.OutputPipeline[1] as PSObject; Assert.AreEqual <string>(roleName, actualOutput.Members[Parameters.CacheWorkerRoleName].Value.ToString()); Assert.AreEqual <int>(expectedInstanceCount, int.Parse(actualOutput.Members[Parameters.Instances].Value.ToString())); } }
public void EnableRemoteDesktopBasicParameterValidation() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop(null, null)); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop(string.Empty, string.Empty)); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", null)); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", string.Empty)); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", "short")); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", "onlylower")); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", "ONLYUPPER")); Testing.AssertThrows <ArgumentException>( () => EnableRemoteDesktop("user", "1234567890")); } }
public void EnableRemoteDesktopForEmptyService() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); files.CreateNewService("NEW_SERVICE"); Testing.AssertThrows <InvalidOperationException>(() => EnableRemoteDesktop("user", "GoodPassword!")); } }
public void AddNewCacheWorkerRoleWithInvalidNamesFail() { using (FileSystemHelper files = new FileSystemHelper(this)) { string rootPath = Path.Combine(files.RootPath, "AzureService"); newServiceCmdlet.NewAzureServiceProcess(files.RootPath, "AzureService"); foreach (string invalidName in Data.InvalidRoleNames) { Testing.AssertThrows <ArgumentException>(() => addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(invalidName, 1, rootPath)); } } }
public void EnableRemoteDesktopUnicodeAndShortPasswordFails() { 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(); Testing.AssertThrows <ArgumentException>(() => EnableRemoteDesktop("㯑䲘䄂㮉", "㯑䲘")); } }
public void InvalidStorageAccountName() { // Create a temp directory that we'll use to "publish" our service using (FileSystemHelper files = new FileSystemHelper(this) { EnableMonitoring = true }) { // Import our default publish settings files.CreateAzureSdkDirectoryAndImportPublishSettings(); string serviceName = null; Testing.AssertThrows <ArgumentException>(() => ServiceSettings.LoadDefault(null, null, null, null, null, "I HAVE INVALID CHARACTERS !@#$%", null, null, out serviceName)); Testing.AssertThrows <ArgumentException>(() => ServiceSettings.LoadDefault(null, null, null, null, null, "ihavevalidcharsbutimjustwaytooooooooooooooooooooooooooooooooooooooooolong", null, null, out serviceName)); } }