示例#1
0
        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"));
            }
        }
示例#2
0
        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()));
            }
        }
示例#3
0
 public void EnableRemoteDesktopForEmptyService()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         files.CreateAzureSdkDirectoryAndImportPublishSettings();
         files.CreateNewService("NEW_SERVICE");
         Testing.AssertThrows <InvalidOperationException>(() =>
                                                          EnableRemoteDesktop("user", "GoodPassword!"));
     }
 }
示例#4
0
        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));
                }
            }
        }
示例#5
0
 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("㯑䲘䄂㮉", "㯑䲘"));
     }
 }
示例#6
0
        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));
            }
        }
示例#7
0
 /// <summary>
 /// Get the contents of a file included in the test project as something to
 /// be copied on Deployment (see Local.testsettings > Deployment for
 /// examples).
 /// </summary>
 /// <param name="relativePath">Relative path to the resource.</param>
 /// <returns>the resource contents.</returns>
 public static string GetTestResourceContents(string relativePath)
 {
     return(File.ReadAllText(Testing.GetTestResourcePath(relativePath)));
 }
示例#8
0
 private static void InitializeInvalidSubscriptionsData()
 {
     InvalidSubscriptionsData.Add(Testing.GetTestResourcePath("invalidsubscriptions.xml"));
 }
示例#9
0
 private static void InitializeValidPublishSettings2Data()
 {
     ValidPublishSettings2.Add(Testing.GetTestResourcePath("ValidProfile2.PublishSettings"));
 }
示例#10
0
 private static void InitializeInvalidPublishSettingsData()
 {
     InvalidPublishSettings.Add(Testing.GetTestResourcePath("InvalidProfile.PublishSettings"));
 }