当前位置: 首页>>代码示例>>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;未经允许,请勿转载。