當前位置: 首頁>>代碼示例>>C#>>正文


C# AzureService類代碼示例

本文整理匯總了C#中AzureService的典型用法代碼示例。如果您正苦於以下問題:C# AzureService類的具體用法?C# AzureService怎麽用?C# AzureService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AzureService類屬於命名空間,在下文中一共展示了AzureService類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetDeploymentStatusProcessDeploymentDoesNotExistTest

        public void SetDeploymentStatusProcessDeploymentDoesNotExistTest()
        {
            SimpleServiceManagement channel = new SimpleServiceManagement();
            string newStatus = DeploymentStatus.Running;
            string resultMessage;
            string expectedMessage = string.Format(Resources.ServiceSlotDoesNotExist, slot, serviceName);
            bool statusUpdated = false;
            channel.UpdateDeploymentStatusBySlotThunk = ar =>
            {
                statusUpdated = true;
                channel.GetDeploymentBySlotThunk = ar2 => new Deployment{Name = serviceName, DeploymentSlot = slot, Status = newStatus};
            };
            channel.GetDeploymentBySlotThunk = ar => { throw new ServiceManagementClientException(HttpStatusCode.NotFound, new ServiceManagementError(), string.Empty); };

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                var deploymentManager = new DeploymentStatusManager(channel);
                deploymentManager.ShareChannel = true;
                deploymentManager.CommandRuntime = new MockCommandRuntime();
                deploymentManager.SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionNames[0], serviceName);
                resultMessage = ((MockCommandRuntime)deploymentManager.CommandRuntime).WarningStream[0];

                Assert.IsFalse(statusUpdated);
                Assert.IsTrue(resultMessage.Contains(expectedMessage));
                Assert.IsTrue(((MockCommandRuntime)deploymentManager.CommandRuntime).OutputPipeline.Count.Equals(0));
            }
        }
開發者ID:huangpf,項目名稱:azure-sdk-tools,代碼行數:29,代碼來源:DeploymentStatusManagerTests.cs

示例2: StartAzureEmulatorProcess

        public AzureService StartAzureEmulatorProcess(string rootPath)
        {
            string standardOutput;
            string standardError;

            StringBuilder message = new StringBuilder();
            AzureService service = new AzureService(rootPath ,null);

            if (Directory.Exists(service.Paths.LocalPackage))
            {
                WriteVerbose(string.Format(Resources.RemovePackage, service.Paths.LocalPackage));
                Directory.Delete(service.Paths.LocalPackage, true);
            }

            WriteVerbose(string.Format(Resources.CreatingPackageMessage, "local"));
            service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);

            WriteVerbose(Resources.StartingEmulator);
            service.StartEmulator(Launch.ToBool(), out standardOutput, out standardError);

            WriteVerbose(standardOutput);
            WriteVerbose(Resources.StartedEmulator);
            SafeWriteOutputPSObject(
                service.GetType().FullName,
                Parameters.ServiceName, service.ServiceName,
                Parameters.RootPath, service.Paths.RootPath);

            return service;
        }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:29,代碼來源:StartAzureEmulator.cs

示例3: RemoveAzureServiceProcessTest

        public void RemoveAzureServiceProcessTest()
        {
            bool serviceDeleted = false;
            bool deploymentDeleted = false;
            channel.GetDeploymentBySlotThunk = ar =>
            {
                if (deploymentDeleted) throw new EndpointNotFoundException();
                return new Deployment(serviceName, ArgumentConstants.Slots[Slot.Production], DeploymentStatus.Suspended);
            };
            channel.DeleteHostedServiceThunk = ar => serviceDeleted = true;
            channel.DeleteDeploymentBySlotThunk = ar =>
            {
                deploymentDeleted = true;
            };
            channel.IsDNSAvailableThunk = ida => new AvailabilityResponse { Result = false };

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                removeServiceCmdlet.PassThru = true;
                removeServiceCmdlet.RemoveAzureServiceProcess(service.Paths.RootPath, string.Empty, serviceName);
                Assert.IsTrue(deploymentDeleted);
                Assert.IsTrue(serviceDeleted);
                Assert.IsTrue((bool)mockCommandRuntime.OutputPipeline[0]);
            }
        }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:27,代碼來源:RemoveAzureServiceTests.cs

示例4: SetDeploymentStatusProcessDeploymentDoesNotExistTest

        public void SetDeploymentStatusProcessDeploymentDoesNotExistTest()
        {
            SimpleServiceManagement channel = new SimpleServiceManagement();
            string newStatus = DeploymentStatus.Running;
            string resultMessage;
            string expectedMessage = string.Format(Resources.ServiceSlotDoesNotExist, serviceName, slot);
            bool statusUpdated = false;
            channel.UpdateDeploymentStatusBySlotThunk = ar =>
            {
                statusUpdated = true;
                channel.GetDeploymentBySlotThunk = ar2 => new Deployment(serviceName, slot, newStatus);
            };
            channel.GetDeploymentBySlotThunk = ar => { throw new EndpointNotFoundException(); };

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                var deploymentManager = new DeploymentStatusManager(channel);
                deploymentManager.ShareChannel = true;
                resultMessage = deploymentManager.SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionName[0], serviceName);

                Assert.IsFalse(statusUpdated);
                Assert.AreEqual<string>(expectedMessage, resultMessage);
            }
        }
開發者ID:nicopeelen,項目名稱:azure-sdk-tools,代碼行數:26,代碼來源:DeploymentStatusManagerTests.cs

示例5: GetAzureRuntimesProcess

 /// <summary>
 /// Retrieve the runtimes from the given manifest, or from the default cloud location, if none given.
 /// The manifest parameter is mainly a testing hook.
 /// </summary>
 /// <param name="runtimeType">The runtime type to filter by</param>
 /// <param name="rootPath">The path to the service in question</param>
 /// <param name="manifest">The path to the manifest file, if null, the default cloud manifest is used (test hook)</param>
 public void GetAzureRuntimesProcess(string runtimeType, string rootPath, string manifest = null)
 {
     AzureService service = new AzureService(rootPath, null);
     CloudRuntimeCollection runtimes = service.GetCloudRuntimes(service.Paths, manifest);
     WriteObject(runtimes.Where<CloudRuntimePackage>(p => string.IsNullOrEmpty(runtimeType) ||
         p.Runtime == CloudRuntime.GetRuntimeByType(runtimeType)), true);
 }
開發者ID:nickchal,項目名稱:pash,代碼行數:14,代碼來源:GetAzureServiceProjectRoleRuntime.cs

示例6: EnableRemoteDesktop

        public void EnableRemoteDesktop()
        {
            Validate.ValidateStringIsNullOrEmpty(Username, "Username");
            if (Password == null)
            {
                throw new ArgumentNullException("Password");
            }
            
            string plainPassword = GetPlainPassword();
            if (!IsPasswordComplex(plainPassword))
            {
                throw new ArgumentException(Properties.Resources.EnableAzureRemoteDesktopCommand_Enable_NeedComplexPassword);
            }

            AzureService service = new AzureService(GetServiceRootPath(), null);
            WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
            WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];

            string forwarderName = GetForwarderName(webRoles, workerRoles);
            RemoveOtherRemoteForwarders(webRoles, workerRoles, forwarderName);
            AddRemoteAccess(webRoles, workerRoles);

            X509Certificate2 cert = ChooseCertificate();
            ServiceConfigurationSchema.Certificate certElement = new ServiceConfigurationSchema.Certificate
            {
                name = "Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption",
                thumbprintAlgorithm = ThumbprintAlgorithmTypes.sha1,
                thumbprint = cert.Thumbprint
            };
            string encryptedPassword = Encrypt(plainPassword, cert);
            
            UpdateServiceConfigurations(service, forwarderName, certElement, encryptedPassword);
            service.Components.Save(service.Paths);
        }
開發者ID:nickchal,項目名稱:pash,代碼行數:34,代碼來源:EnableAzureRemoteDesktop.cs

示例7: GetNextPortAllNull

 public void GetNextPortAllNull()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         int expectedPort = int.Parse(Resources.DefaultWebPort);
         AzureService service = new AzureService(files.RootPath, serviceName, null);
         int nextPort = service.Components.GetNextPort();
         Assert.AreEqual<int>(expectedPort, nextPort);
     }
 }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:10,代碼來源:ServiceComponentsTests.cs

示例8: StopAzureEmulatorProcess

        public string StopAzureEmulatorProcess()
        {
            string standardOutput;
            string standardError;

            AzureService service = new AzureService();
            SafeWriteObject(Resources.StopEmulatorMessage);
            service.StopEmulator(out standardOutput, out standardError);
            SafeWriteObject(Resources.StoppedEmulatorMessage);
            return null;
        }
開發者ID:paulyuk,項目名稱:azure-sdk-tools,代碼行數:11,代碼來源:StopAzureEmulator.cs

示例9: GetNextPortNodeWebRoleNull

 public void GetNextPortNodeWebRoleNull()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         int expectedPort = int.Parse(Resources.DefaultPort);
         AzureService service = new AzureService(files.RootPath, serviceName, null);
         service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath);
         service = new AzureService(service.Paths.RootPath, null);
         int nextPort = service.Components.GetNextPort();
         Assert.AreEqual<int>(expectedPort, nextPort);
     }
 }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:12,代碼來源:ServiceComponentsTests.cs

示例10: CreateLocalPackageWithNodeWorkerRoleTest

        public void CreateLocalPackageWithNodeWorkerRoleTest()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string standardOutput;
                string standardError;
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                service.AddWorkerRole(Data.NodeWorkerRoleScaffoldingPath);
                service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);

                AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WorkerRole1\approot"), Path.Combine(Resources.NodeScaffolding, Resources.WorkerRole));
            }
        }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:13,代碼來源:CsPackTests.cs

示例11: NewAzureServiceProcess

        internal string NewAzureServiceProcess(string parentDirectory, string serviceName)
        {
            string message;
            AzureService newService;

            // Create scaffolding structure
            //
            newService = new AzureService(parentDirectory, serviceName, null);
            
            message = string.Format(Resources.NewServiceCreatedMessage, newService.Paths.RootPath);

            return message;
        }
開發者ID:nickchal,項目名稱:pash,代碼行數:13,代碼來源:NewAzureServiceProject.cs

示例12: GetNextPortAddingThirdEndpoint

 public void GetNextPortAddingThirdEndpoint()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         int expectedPort = int.Parse(Resources.DefaultPort) + 1;
         AzureService service = new AzureService(files.RootPath, serviceName, null);
         service.AddWebRole(Resources.NodeScaffolding);
         service.AddWebRole(Resources.PHPScaffolding);
         service = new AzureServiceWrapper(service.Paths.RootPath, null);
         int nextPort = service.Components.GetNextPort();
         Assert.AreEqual<int>(expectedPort, nextPort);
     }
 }
開發者ID:nicopeelen,項目名稱:azure-sdk-tools,代碼行數:13,代碼來源:ServiceComponentsTests.cs

示例13: DisableRemoteDesktop

        public void DisableRemoteDesktop()
        {
            AzureService service = new AzureService(GetServiceRootPath(), null);
            WebRole[] webRoles = service.Components.Definition.WebRole ?? new WebRole[0];
            WorkerRole[] workerRoles = service.Components.Definition.WorkerRole ?? new WorkerRole[0];

            string forwarderName = GetForwarderName(webRoles, workerRoles);
            if (forwarderName != null)
            {
                UpdateServiceConfigurations(service, forwarderName);
                service.Components.Save(service.Paths);
            }
        }
開發者ID:paulyuk,項目名稱:azure-sdk-tools,代碼行數:13,代碼來源:DisableAzureRemoteDesktop.cs

示例14: StartAzureEmulatorProcess

        public string StartAzureEmulatorProcess(string rootPath)
        {
            string standardOutput;
            string standardError;

            StringBuilder message = new StringBuilder();
            AzureService service = new AzureService(rootPath ,null);
            SafeWriteObject(string.Format(Resources.CreatingPackageMessage, "local"));
            service.CreatePackage(DevEnv.Local, out standardOutput, out standardError);
            SafeWriteObject(Resources.StartingEmulator);
            service.StartEmulator(Launch.ToBool(), out standardOutput, out standardError);
            SafeWriteObject(standardOutput);
            SafeWriteObject(Resources.StartedEmulator);
            return message.ToString();
        }
開發者ID:nickchal,項目名稱:pash,代碼行數:15,代碼來源:StartAzureEmulator.cs

示例15: StopAzureEmulatorProcess

        public void StopAzureEmulatorProcess()
        {
            string standardOutput;
            string standardError;

            AzureService service = new AzureService();
            WriteVerbose(Resources.StopEmulatorMessage);
            service.StopEmulator(out standardOutput, out standardError);

            WriteVerbose(Resources.StoppedEmulatorMessage);

            if (PassThru.IsPresent)
            {
                WriteObject(true);
            }
        }
開發者ID:bielawb,項目名稱:azure-sdk-tools,代碼行數:16,代碼來源:StopAzureEmulator.cs


注:本文中的AzureService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。