当前位置: 首页>>代码示例>>C#>>正文


C# FileSystemHelper类代码示例

本文整理汇总了C#中FileSystemHelper的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper类的具体用法?C# FileSystemHelper怎么用?C# FileSystemHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileSystemHelper类属于命名空间,在下文中一共展示了FileSystemHelper类的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: SetDeploymentStatusProcessSetStatusToActualStatusTest

        public void SetDeploymentStatusProcessSetStatusToActualStatusTest()
        {
            SimpleServiceManagement channel = new SimpleServiceManagement();
            string newStatus = DeploymentStatus.Suspended;
            string currentStatus = DeploymentStatus.Suspended;
            string resultMessage;
            string expectedMessage = string.Format(Resources.DeploymentAlreadyInState, slot, serviceName, currentStatus);
            bool statusUpdated = false;
            channel.UpdateDeploymentStatusBySlotThunk = ar =>
            {
                statusUpdated = true;
                channel.GetDeploymentBySlotThunk = ar2 => new Deployment(serviceName, slot, newStatus);
            };
            channel.GetDeploymentBySlotThunk = ar => new Deployment(serviceName, slot, currentStatus);

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

                Assert.IsFalse(statusUpdated);
                Assert.AreEqual<string>(expectedMessage, resultMessage);
            }
        }
开发者ID:calexan,项目名称:azure-sdk-tools,代码行数:25,代码来源:DeploymentStatusManagerTests.cs

示例3: AddNewCacheWorkerRoleSuccessful

        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(AzureAssert.GetCloudRole(rootPath, roleName));
                AssertConfigExists(AzureAssert.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()));
            }
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:27,代码来源:AddAzureCacheWorkerRoleTests.cs

示例4: AddAzureWebRoleWillRecreateDeploymentSettings

        public void AddAzureWebRoleWillRecreateDeploymentSettings()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string roleName = "WebRole1";
                string serviceName = "AzureService";
                string rootPath = files.CreateNewService(serviceName);
                string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreate, rootPath, roleName);
                string settingsFilePath = Path.Combine(rootPath, Resources.SettingsFileName);
                string originalDirectory = Directory.GetCurrentDirectory();
                Directory.SetCurrentDirectory(rootPath);
                File.Delete(settingsFilePath);
                Assert.IsFalse(File.Exists(settingsFilePath));
                addWebCmdlet = new AddAzureWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = roleName };

                addWebCmdlet.ExecuteCmdlet();

                AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, "AzureService", roleName), Path.Combine(Resources.GeneralScaffolding, Resources.WebRole));
                Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
                Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
                Assert.IsTrue(File.Exists(settingsFilePath));

                Directory.SetCurrentDirectory(originalDirectory);
            }
        }
开发者ID:B-Rich,项目名称:azure-sdk-tools,代码行数:25,代码来源:AddAzureWebRoleTests.cs

示例5: 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

示例6: AzureServiceAddNewWorkerRoleWithWhiteCharFail

 public void AzureServiceAddNewWorkerRoleWithWhiteCharFail()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         Testing.AssertThrows<ArgumentException>(() => new AzureService(files.RootPath, serviceName, null).AddWebRole("\tRole"), string.Format(Resources.InvalidRoleNameMessage, "\tRole"));
     }
 }
开发者ID:calexan,项目名称:azure-sdk-tools,代码行数:7,代码来源:AzureServiceTests.cs

示例7: 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

示例8: SetAzureServiceProjectTestsLocationValid

        public void SetAzureServiceProjectTestsLocationValid()
        {
            string[] locations = { "West US", "East US", "East Asia", "North Europe" };
            foreach (string item in locations)
            {
                using (FileSystemHelper files = new FileSystemHelper(this))
                {
                    // Create new empty settings file
                    //
                    PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
                    ServiceSettings settings = new ServiceSettings();
                    mockCommandRuntime = new MockCommandRuntime();
                    setServiceProjectCmdlet.CommandRuntime = mockCommandRuntime;
                    settings.Save(paths.Settings);

                    settings = setServiceProjectCmdlet.SetAzureServiceProjectProcess(item, null, null, paths.Settings);

                    // Assert location is changed
                    //
                    Assert.AreEqual<string>(item, settings.Location);
                    ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings;
                    Assert.AreEqual<string>(item, settings.Location);
                }
            }
        }
开发者ID:kangyangthu,项目名称:azure-sdk-tools,代码行数:25,代码来源:SetAzureServiceProjectTests.cs

示例9: AddNewCacheWorkerRoleSuccessful

        public void AddNewCacheWorkerRoleSuccessful()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                string servicePath = Path.Combine(files.RootPath, "AzureService");
                string roleName = "WorkerRole";
                int expectedInstanceCount = 10;
                new NewAzureServiceProjectCommand().NewAzureServiceProcess(files.RootPath, "AzureService");
                WorkerRole cacheWorkerRole = cmdlet.AddAzureCacheWorkerRoleProcess(roleName, expectedInstanceCount, servicePath);
                RoleSettings cacheRoleSettings = Testing.GetRole(servicePath, roleName);

                AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, "AzureService", "WorkerRole"), Path.Combine(Resources.NodeScaffolding, 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);

                AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.NamedCacheSettingName, value = Resources.NamedCacheSettingValue }, cacheRoleSettings.ConfigurationSettings);
                AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.DiagnosticLevelName, value = Resources.DiagnosticLevelValue }, cacheRoleSettings.ConfigurationSettings);
                AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.CachingCacheSizePercentageSettingName, value = string.Empty }, cacheRoleSettings.ConfigurationSettings);
                AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.CachingConfigStoreConnectionStringSettingName, value = string.Empty }, cacheRoleSettings.ConfigurationSettings);

                PSObject actualOutput = writer.OutputChannel[0] as PSObject;
                Assert.AreEqual<string>(roleName, actualOutput.Members[Parameters.CacheWorkerRoleName].Value.ToString());
                Assert.AreEqual<int>(expectedInstanceCount, int.Parse(actualOutput.Members[Parameters.Instances].Value.ToString()));
            }
        }
开发者ID:arri-cc,项目名称:azure-sdk-tools,代码行数:30,代码来源:AddAzureCacheWorkerRoleTests.cs

示例10: RemoveAzureServiceProcessTest

        public void RemoveAzureServiceProcessTest()
        {
            SimpleServiceManagement channel = new SimpleServiceManagement();
            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;
            };

            using (FileSystemHelper files = new FileSystemHelper(this))
            {

                files.CreateAzureSdkDirectoryAndImportPublishSettings();
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                new RemoveAzureServiceCommand(channel).RemoveAzureServiceProcess(service.Paths.RootPath, string.Empty);
                Assert.IsTrue(deploymentDeleted);
                Assert.IsTrue(serviceDeleted);
            }
        }
开发者ID:kirillg,项目名称:azure-sdk-tools,代码行数:26,代码来源:RemoveAzureServiceTests.cs

示例11: SetAzureInstancesProcessTestsEmptyRoleNameFail

 public void SetAzureInstancesProcessTestsEmptyRoleNameFail()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         AzureService service = new AzureService(files.RootPath, serviceName, null);
         Testing.AssertThrows<ArgumentException>(() => service.SetRoleInstances(service.Paths, string.Empty, 10), string.Format(Resources.InvalidOrEmptyArgumentMessage, Resources.RoleName));
     }
 }
开发者ID:kirillg,项目名称:azure-sdk-tools,代码行数:8,代码来源:SetAzureInstancesTests.cs

示例12: AzureServiceAddExistingRoleFail

 public void AzureServiceAddExistingRoleFail()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         AzureService service = new AzureService(files.RootPath, serviceName, null);
         service.AddWebRole("WebRole");
         Testing.AssertThrows<ArgumentException>(() => service.AddWebRole("WebRole"), string.Format(Resources.AddRoleMessageRoleExists, "WebRole"));
     }
 }
开发者ID:calexan,项目名称:azure-sdk-tools,代码行数:9,代码来源:AzureServiceTests.cs

示例13: DisableRemoteDesktopForEmptyService

 public void DisableRemoteDesktopForEmptyService()
 {
     using (FileSystemHelper files = new FileSystemHelper(this))
     {
         files.CreateAzureSdkDirectoryAndImportPublishSettings();
         files.CreateNewService("NEW_SERVICE");
         disableRDCmdlet.DisableRemoteDesktop();
     }
 }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:9,代码来源:DisableAzureRemoteDesktopCommandTest.cs

示例14: AddAzureNodeWorkerRoleProcess

        public void AddAzureNodeWorkerRoleProcess()
        {
            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                new NewAzureServiceProjectCommand().NewAzureServiceProcess(files.RootPath, "AzureService");
                new AddAzureNodeWorkerRoleCommand().AddAzureNodeWorkerRoleProcess("WorkerRole", 1, Path.Combine(files.RootPath, "AzureService"));

                AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, "AzureService", "WorkerRole"), Path.Combine(Resources.NodeScaffolding, Resources.WorkerRole));
            }
        }
开发者ID:brian-swan,项目名称:azure-sdk-tools,代码行数:10,代码来源:AddAzureNodeWorkerRoleTests.cs

示例15: SetAzureInstancesProcessNegativeRoleInstanceFail

        public void SetAzureInstancesProcessNegativeRoleInstanceFail()
        {
            string roleName = "WebRole1";

            using (FileSystemHelper files = new FileSystemHelper(this))
            {
                AzureService service = new AzureService(files.RootPath, serviceName, null);
                Testing.AssertThrows<ArgumentException>(() => service.SetRoleInstances(service.Paths, roleName, -1), string.Format(Resources.InvalidInstancesCount, roleName));
            }
        }
开发者ID:kirillg,项目名称:azure-sdk-tools,代码行数:10,代码来源:SetAzureInstancesTests.cs


注:本文中的FileSystemHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。