本文整理汇总了C#中Microsoft.WindowsAzure.Commands.Test.Utilities.Common.FileSystemHelper类的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper类的具体用法?C# FileSystemHelper怎么用?C# FileSystemHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileSystemHelper类属于Microsoft.WindowsAzure.Commands.Test.Utilities.Common命名空间,在下文中一共展示了FileSystemHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddAzureWorkerRoleWillRecreateDeploymentSettings
public void AddAzureWorkerRoleWillRecreateDeploymentSettings()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string roleName = "WorkerRole1";
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.False(File.Exists(settingsFilePath));
addWorkerCmdlet = new AddAzureWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = roleName };
addWorkerCmdlet.ExecuteCmdlet();
AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.GeneralScaffolding, Resources.WorkerRole));
Assert.Equal<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
Assert.Equal<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
Assert.True(File.Exists(settingsFilePath));
Directory.SetCurrentDirectory(originalDirectory);
}
}
开发者ID:shuainie,项目名称:azure-powershell,代码行数:25,代码来源:AddAzureWorkerRoleTests.cs
示例2: 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.Equal<string>(item, settings.Location);
ServiceSettings actualOutput = mockCommandRuntime.OutputPipeline[0] as ServiceSettings;
Assert.Equal<string>(item, settings.Location);
}
}
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:25,代码来源:SetAzureServiceProjectTests.cs
示例3: PublishFromProjectFile
public void PublishFromProjectFile()
{
var websiteName = "test-site";
string slot = null;
var projectFile = string.Format(@"{0}\Resources\MyWebApplication\WebApplication4.csproj", Directory.GetCurrentDirectory());
var configuration = "Debug";
var logFile = string.Format(@"{0}\build.log", Directory.GetCurrentDirectory());
var connectionStrings = new Hashtable();
connectionStrings["DefaultConnection"] = "test-connection-string";
using (FileSystemHelper files = new FileSystemHelper(this))
{
string originalDirectory = Directory.GetCurrentDirectory();
}
var publishProfile = new WebSiteGetPublishProfileResponse.PublishProfile()
{
UserName = "test-user-name",
UserPassword = "test-password",
PublishUrl = "test-publlish-url"
};
var package = "test-package.zip";
var published = false;
Mock<IWebsitesClient> clientMock = new Mock<IWebsitesClient>();
clientMock.Setup(c => c.GetWebDeployPublishProfile(websiteName, slot)).Returns(publishProfile);
clientMock.Setup(c => c.BuildWebProject(projectFile, configuration, logFile)).Returns(package);
clientMock.Setup(c => c.PublishWebProject(websiteName, slot, package, connectionStrings, false, false))
.Callback((string n, string s, string p, Hashtable cs, bool skipAppData, bool doNotDelete) =>
{
Assert.Equal(websiteName, n);
Assert.Equal(slot, s);
Assert.Equal(package, p);
Assert.Equal(connectionStrings, cs);
Assert.False(skipAppData);
Assert.False(doNotDelete);
published = true;
});
Mock<ICommandRuntime> powerShellMock = new Mock<ICommandRuntime>();
var command = new PublishAzureWebsiteProject()
{
CommandRuntime = powerShellMock.Object,
WebsitesClient = clientMock.Object,
Name = websiteName,
ProjectFile = projectFile,
Configuration = configuration,
ConnectionString = connectionStrings
};
command.ExecuteCmdlet();
powerShellMock.Verify(f => f.WriteVerbose(string.Format("[Complete] Publishing package {0}", package)), Times.Once());
Assert.True(published);
}
开发者ID:randorfer,项目名称:azure-powershell,代码行数:58,代码来源:PublishAzureWebsiteProjectTests.cs
示例4: DisableRemoteDesktopForEmptyService
public void DisableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
disableRDCmdlet.DisableRemoteDesktop();
}
}
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:9,代码来源:DisableAzureRemoteDesktopCommandTest.cs
示例5: NewAzureServiceWithInvalidNames
public void NewAzureServiceWithInvalidNames()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
foreach (string name in Test.Utilities.Common.Data.InvalidServiceNames)
{
cmdlet.ServiceName = name;
Testing.AssertThrows<ArgumentException>(() => cmdlet.ExecuteCmdlet());
}
}
}
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:11,代码来源:NewAzureServiceTests.cs
示例6: CreateLocalPackageWithPHPWorkerRoleTest
public void CreateLocalPackageWithPHPWorkerRoleTest()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
service.AddWorkerRole(Test.Utilities.Common.Data.PHPWorkerRoleScaffoldingPath);
service.CreatePackage(DevEnv.Local);
AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WorkerRole1\approot"), Path.Combine(Resources.PHPScaffolding, Resources.WorkerRole));
}
}
开发者ID:randorfer,项目名称:azure-powershell,代码行数:11,代码来源:CsPackTests.cs
示例7: NewAzureRoleTemplateWithOutputPath
public void NewAzureRoleTemplateWithOutputPath()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string outputPath = files.RootPath;
addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Worker = true, CommandRuntime = mockCommandRuntime, Output = outputPath };
addTemplateCmdlet.ExecuteCmdlet();
Assert.Equal<string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.Path));
Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath);
}
}
开发者ID:shuainie,项目名称:azure-powershell,代码行数:13,代码来源:NewAzureRoleTemplateTests.cs
示例8: DisableRemoteDesktopForWebAndWorkerRoles
public void DisableRemoteDesktopForWebAndWorkerRoles()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
string rootPath = files.CreateNewService("NEW_SERVICE");
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole" };
addNodeWebCmdlet.ExecuteCmdlet();
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole" };
addNodeWorkerCmdlet.ExecuteCmdlet();
disableRDCmdlet.DisableRemoteDesktop();
}
}
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:13,代码来源:DisableAzureRemoteDesktopCommandTest.cs
示例9: SetAzureServiceProjectTestsLocationEmptyFail
public void SetAzureServiceProjectTestsLocationEmptyFail()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
// Create new empty settings file
//
PowerShellProjectPathInfo paths = new PowerShellProjectPathInfo(files.RootPath);
ServiceSettings settings = new ServiceSettings();
settings.Save(paths.Settings);
Testing.AssertThrows<ArgumentException>(() => setServiceProjectCmdlet.SetAzureServiceProjectProcess(string.Empty, null, null, paths.Settings), string.Format(Resources.InvalidOrEmptyArgumentMessage, "Location"));
}
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:13,代码来源:SetAzureServiceProjectTests.cs
示例10: AddAzurePythonWebRoleProcess
public void AddAzurePythonWebRoleProcess()
{
var pyInstall = AddAzureDjangoWebRoleCommand.FindPythonInterpreterPath();
if (pyInstall == null)
{
Assert.True(false, "Python is not installed on this machine and therefore the Python tests cannot be run");
return;
}
string stdOut, stdErr;
ProcessHelper.StartAndWaitForProcess(
new ProcessStartInfo(
Path.Combine(pyInstall, "python.exe"),
string.Format("-m django.bin.django-admin")
),
out stdOut,
out stdErr
);
if (stdOut.IndexOf("django-admin.py") == -1)
{
Assert.True(false, "Django is not installed on this machine and therefore the Python tests cannot be run. Please 'pip install Django==1.5'");
return;
}
using (FileSystemHelper files = new FileSystemHelper(this))
{
string roleName = "WebRole1";
string serviceName = "AzureService";
string rootPath = files.CreateNewService(serviceName);
addPythonWebCmdlet = new AddAzureDjangoWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime };
addPythonWebCmdlet.CommandRuntime = mockCommandRuntime;
string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePython, rootPath, roleName);
mockCommandRuntime.ResetPipelines();
addPythonWebCmdlet.ExecuteCmdlet();
AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PythonScaffolding, Resources.WebRole));
Assert.Equal<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
Assert.Equal<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
Assert.True(Directory.Exists(Path.Combine(rootPath, roleName, roleName)));
Assert.True(File.Exists(Path.Combine(rootPath, roleName, roleName, "manage.py")));
Assert.True(Directory.Exists(Path.Combine(rootPath, roleName, roleName, roleName)));
Assert.True(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "__init__.py")));
Assert.True(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "settings.py")));
Assert.True(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "urls.py")));
Assert.True(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "wsgi.py")));
}
}
开发者ID:Indhukrishna,项目名称:azure-powershell,代码行数:49,代码来源:AddAzurePythonWebRoleTests.cs
示例11: AddNewCacheWorkerRoleDoesNotHaveAnyRuntime
public void AddNewCacheWorkerRoleDoesNotHaveAnyRuntime()
{
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);
Variable runtimeId = Array.Find<Variable>(cacheWorkerRole.Startup.Task[0].Environment, v => v.name.Equals(Resources.RuntimeTypeKey));
Assert.Equal<string>(string.Empty, runtimeId.value);
}
}
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:15,代码来源:AddAzureCacheWorkerRoleTests.cs
示例12: InvalidStorageAccountName
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 [email protected]#$%", null, null, out serviceName));
Testing.AssertThrows<ArgumentException>(() =>
ServiceSettings.LoadDefault(null, null, null, null, null, "ihavevalidcharsbutimjustwaytooooooooooooooooooooooooooooooooooooooooolong", null, null, out serviceName));
}
}
开发者ID:Indhukrishna,项目名称:azure-powershell,代码行数:15,代码来源:ServiceSettingsTests.cs
示例13: SanitizeServiceNameForStorageAccountName
public void SanitizeServiceNameForStorageAccountName()
{
// 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;
ServiceSettings settings = ServiceSettings.LoadDefault(null, null, null, null, null, null, "My-Custom-Service!", null, out serviceName);
Assert.Equal("myx2dcustomx2dservicex21", settings.StorageServiceName);
settings = ServiceSettings.LoadDefault(null, null, null, null, null, null, "MyCustomServiceIsWayTooooooooooooooooooooooooLong", null, out serviceName);
Assert.Equal("mycustomserviceiswaytooo", settings.StorageServiceName);
}
}
开发者ID:Indhukrishna,项目名称:azure-powershell,代码行数:16,代码来源:ServiceSettingsTests.cs
示例14: TestGetRuntimes
public void TestGetRuntimes()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string manifest = RuntimePackageHelper.GetTestManifest(files);
CloudRuntimeCollection runtimes;
CloudRuntimeCollection.CreateCloudRuntimeCollection(out runtimes, manifest);
cmdlet.GetAzureRuntimesProcess(string.Empty, manifest);
IEnumerable<CloudRuntimePackage> actual = System.Management.Automation.LanguagePrimitives.GetEnumerable( mockCommandRuntime.OutputPipeline).Cast<CloudRuntimePackage>();
Assert.Equal<int>(runtimes.Count, actual.Count());
Assert.True(runtimes.All<CloudRuntimePackage>(p => actual.Any<CloudRuntimePackage>(p2 => p2.PackageUri.Equals(p.PackageUri))));
}
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:16,代码来源:GetAzureServiceProjectRuntimesTest.cs
示例15: TestStartAzureService
public void TestStartAzureService()
{
stopServiceCmdlet.ServiceName = serviceName;
stopServiceCmdlet.Slot = slot;
cloudServiceClientMock.Setup(f => f.StartCloudService(serviceName, slot));
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
stopServiceCmdlet.ExecuteCmdlet();
Assert.Equal<int>(0, mockCommandRuntime.OutputPipeline.Count);
cloudServiceClientMock.Verify(f => f.StartCloudService(serviceName, slot), Times.Once());
}
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:16,代码来源:StartAzureServiceTests.cs
示例16: TestGetRuntimes
public void TestGetRuntimes()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string manifest = RuntimePackageHelper.GetTestManifest(files);
CloudRuntimeCollection runtimes;
CloudRuntimeCollection.CreateCloudRuntimeCollection(out runtimes, manifest);
cmdlet.GetAzureRuntimesProcess(string.Empty, manifest);
List<CloudRuntimePackage> actual = mockCommandRuntime.OutputPipeline[0] as List<CloudRuntimePackage>;
Assert.Equal<int>(runtimes.Count, actual.Count);
Assert.True(runtimes.All<CloudRuntimePackage>(p => actual.Any<CloudRuntimePackage>(p2 => p2.PackageUri.Equals(p.PackageUri))));
}
}
开发者ID:Indhukrishna,项目名称:azure-powershell,代码行数:16,代码来源:GetAzureServiceProjectRuntimesTest.cs
示例17: AddAzureNodeWorkerRoleProcess
public void AddAzureNodeWorkerRoleProcess()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string roleName = "WorkerRole1";
string serviceName = "AzureService";
string rootPath = files.CreateNewService(serviceName);
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime };
string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreateNode, rootPath, roleName);
addNodeWorkerCmdlet.ExecuteCmdlet();
AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.NodeScaffolding, Resources.WorkerRole));
Assert.Equal<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
Assert.Equal<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
}
}
开发者ID:shuainie,项目名称:azure-powershell,代码行数:17,代码来源:AddAzureNodeWorkerRoleTests.cs
示例18: TestCreatePackageWithEmptyServiceSuccessfull
public void TestCreatePackageWithEmptyServiceSuccessfull()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
string rootPath = Path.Combine(files.RootPath, "NEW_SERVICE");
string packagePath = Path.Combine(rootPath, Resources.CloudPackageFileName);
cmdlet.ExecuteCmdlet();
PSObject obj = mockCommandRuntime.OutputPipeline[0] as PSObject;
Assert.Equal<string>(string.Format(Resources.PackageCreated, packagePath), mockCommandRuntime.VerboseStream[0]);
Assert.Equal<string>(packagePath, obj.GetVariableValue<string>(Parameters.PackagePath));
Assert.True(File.Exists(packagePath));
}
}
开发者ID:shuainie,项目名称:azure-powershell,代码行数:17,代码来源:SaveAzureServiceProjectPackageTests.cs
示例19: CreateLocalPackageWithOnePHPWebRoleTest
public void CreateLocalPackageWithOnePHPWebRoleTest()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
RoleInfo webRoleInfo = service.AddWebRole(Test.Utilities.Common.Data.PHPWebRoleScaffoldingPath);
string logsDir = Path.Combine(service.Paths.RootPath, webRoleInfo.Name, "server.js.logs");
string logFile = Path.Combine(logsDir, "0.txt");
string targetLogsFile = Path.Combine(service.Paths.LocalPackage, "roles", webRoleInfo.Name, @"approot\server.js.logs\0.txt");
files.CreateDirectory(logsDir);
files.CreateEmptyFile(logFile);
service.CreatePackage(DevEnv.Local);
AzureAssert.ScaffoldingExists(Path.Combine(service.Paths.LocalPackage, @"roles\WebRole1\approot"), Path.Combine(Resources.PHPScaffolding, Resources.WebRole));
Assert.True(File.Exists(targetLogsFile));
}
}
开发者ID:randorfer,项目名称:azure-powershell,代码行数:17,代码来源:CsPackTests.cs
示例20: CreateCloudPackageWithMultipleRoles
public void CreateCloudPackageWithMultipleRoles()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
CloudServiceProject service = new CloudServiceProject(files.RootPath, serviceName, null);
service.AddWorkerRole(Test.Utilities.Common.Data.NodeWorkerRoleScaffoldingPath);
service.AddWebRole(Test.Utilities.Common.Data.NodeWebRoleScaffoldingPath);
service.AddWorkerRole(Test.Utilities.Common.Data.PHPWorkerRoleScaffoldingPath);
service.AddWebRole(Test.Utilities.Common.Data.PHPWebRoleScaffoldingPath);
service.CreatePackage(DevEnv.Cloud);
using (Package package = Package.Open(service.Paths.CloudPackage))
{
Assert.Equal(9, package.GetParts().Count());
}
}
}
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:17,代码来源:CsPackTests.cs
注:本文中的Microsoft.WindowsAzure.Commands.Test.Utilities.Common.FileSystemHelper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论