本文整理汇总了C#中Microsoft.WindowsAzure.Management.Test.Utilities.Common.FileSystemHelper.CreateNewService方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper.CreateNewService方法的具体用法?C# FileSystemHelper.CreateNewService怎么用?C# FileSystemHelper.CreateNewService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Management.Test.Utilities.Common.FileSystemHelper
的用法示例。
在下文中一共展示了FileSystemHelper.CreateNewService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: TestCreateStorageServiceWithPublish
public void TestCreateStorageServiceWithPublish()
{
using (FileSystemHelper files = new FileSystemHelper(this) { EnableMonitoring = true })
{
// Setup
string rootPath = files.CreateNewService(serviceName);
files.CreateAzureSdkDirectoryAndImportPublishSettings();
CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null);
cloudServiceProject.AddWebRole(Data.NodeWebRoleScaffoldingPath);
cloudService.Deployments.Add(deployment);
serviceManagementChannelMock.Setup(f => f.EndGetStorageService(It.IsAny<IAsyncResult>()))
.Callback(() => serviceManagementChannelMock.Setup(f => f.EndGetStorageService(
It.IsAny<IAsyncResult>()))
.Returns(storageService))
.Throws(new EndpointNotFoundException());
ExecuteInTempCurrentDirectory(rootPath, () => client.PublishCloudService(location: "West US"));
serviceManagementChannelMock.Verify(f => f.BeginCreateStorageService(
subscription.SubscriptionId,
It.IsAny<CreateStorageServiceInput>(),
null,
null), Times.Once());
}
}
示例3: DisableRemoteDesktopForEmptyService
public void DisableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
disableRDCmdlet.DisableRemoteDesktop();
}
}
示例4: 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();
}
}
示例5: DisableRemoteDesktopForWebRole
public void DisableRemoteDesktopForWebRole()
{
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();
disableRDCmdlet.PassThru = true;
disableRDCmdlet.DisableRemoteDesktop();
Assert.IsTrue((bool)mockCommandRuntime.OutputPipeline[1]);
}
}
示例6: AddAzurePythonWebRoleProcess
public void AddAzurePythonWebRoleProcess()
{
var pyInstall = AddAzureDjangoWebRoleCommand.FindPythonInterpreterPath();
if (pyInstall == null)
{
Assert.Inconclusive("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.Inconclusive("Django is not installed on this machine and therefore the Python tests cannot be run");
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.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName)));
Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, "manage.py")));
Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName, roleName)));
Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "__init__.py")));
Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "settings.py")));
Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "urls.py")));
Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "wsgi.py")));
}
}
示例7: AddAzureNodeWebRoleProcess
public void AddAzureNodeWebRoleProcess()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string roleName = "WebRole1";
string serviceName = "AzureService";
string rootPath = files.CreateNewService(serviceName);
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime };
string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreateNode, rootPath, roleName);
addNodeWebCmdlet.ExecuteCmdlet();
AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.NodeScaffolding, Resources.WebRole));
Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName));
Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]);
}
}
示例8: EnableAzureMemcacheRoleProcessAlreadyEnabledFail
public void EnableAzureMemcacheRoleProcessAlreadyEnabledFail()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string serviceName = "AzureService";
string rootPath = files.CreateNewService(serviceName);
string cacheRoleName = "WorkerRole";
string webRoleName = "WebRole";
string expected = string.Format(Resources.CacheAlreadyEnabledMessage, webRoleName);
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName };
addNodeWebCmdlet.ExecuteCmdlet();
addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);
enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath);
Testing.AssertThrows<Exception>(() => enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath));
}
}
示例9: TestCreatePackageSuccessfull
public void TestCreatePackageSuccessfull()
{
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);
AzureService service = new AzureService(rootPath, null);
service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
cmdlet.ExecuteCmdlet();
PSObject obj = mockCommandRuntime.OutputPipeline[0] as PSObject;
Assert.AreEqual<string>(string.Format(Resources.PackageCreated, packagePath), mockCommandRuntime.VerboseStream[0]);
Assert.AreEqual<string>(packagePath, obj.GetVariableValue<string>(Parameters.PackagePath));
Assert.IsTrue(File.Exists(packagePath));
}
}
示例10: TestPublishNewCloudService
public void TestPublishNewCloudService()
{
using (FileSystemHelper files = new FileSystemHelper(this) { EnableMonitoring = true })
{
// Setup
string rootPath = files.CreateNewService(serviceName);
files.CreateAzureSdkDirectoryAndImportPublishSettings();
CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null);
cloudServiceProject.AddWebRole(Data.NodeWebRoleScaffoldingPath);
ExecuteInTempCurrentDirectory(rootPath, () => client.PublishCloudService(location: "West US"));
serviceManagementChannelMock.Verify(f => f.BeginCreateOrUpdateDeployment(
subscription.SubscriptionId,
serviceName,
DeploymentSlotType.Production,
It.IsAny<CreateDeploymentInput>(),
null,
null), Times.Once());
}
}
示例11: EnableAzureMemcacheRoleProcess
public void EnableAzureMemcacheRoleProcess()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
string serviceName = "AzureService";
string rootPath = files.CreateNewService(serviceName);
string cacheRoleName = "WorkerRole";
string webRoleName = "WebRole";
string expectedMessage = string.Format(Resources.EnableMemcacheMessage, webRoleName, cacheRoleName, Resources.MemcacheEndpointPort);
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName };
addNodeWebCmdlet.ExecuteCmdlet();
addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);
mockCommandRuntime.ResetPipelines();
enableCacheCmdlet.PassThru = true;
enableCacheCmdlet.CacheRuntimeVersion = "1.8.0";
enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath);
AssertCachingEnabled(files, serviceName, rootPath, webRoleName, expectedMessage);
}
}
示例12: EnableDisableEnableRemoteDesktopForWebAndWorkerRoles
public void EnableDisableEnableRemoteDesktopForWebAndWorkerRoles()
{
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();
EnableAzureRemoteDesktopCommandTest.EnableRemoteDesktop("user", "GoodPassword!");
disableRDCmdlet.DisableRemoteDesktop();
EnableAzureRemoteDesktopCommandTest.EnableRemoteDesktop("user", "GoodPassword!");
// Verify the roles have been setup with forwarding, access,
// and certs
AzureService service = new AzureService(rootPath, null);
EnableAzureRemoteDesktopCommandTest.VerifyWebRole(service.Components.Definition.WebRole[0], false);
EnableAzureRemoteDesktopCommandTest.VerifyWorkerRole(service.Components.Definition.WorkerRole[0], true);
EnableAzureRemoteDesktopCommandTest.VerifyRoleSettings(service);
}
}
示例13: ThrowsErrorForInvalidCacheVersion
public void ThrowsErrorForInvalidCacheVersion()
{
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);
string cacheRoleName = "WorkerRole1";
AddAzureCacheWorkerRoleCommand addCacheWorkerCmdlet = new AddAzureCacheWorkerRoleCommand()
{
CommandRuntime = mockCommandRuntime
};
EnableAzureMemcacheRoleCommand enableCacheCmdlet = new EnableAzureMemcacheRoleCommand()
{
CacheRuntimeVersion = "1.8.0",
CommandRuntime = mockCommandRuntime
};
CloudServiceProject service = new CloudServiceProject(rootPath, null);
service.AddWebRole(Data.NodeWebRoleScaffoldingPath);
addCacheWorkerCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath);
enableCacheCmdlet.EnableAzureMemcacheRoleProcess("WebRole1", cacheRoleName, rootPath);
Testing.AssertThrows<Exception>(
() => cmdlet.ExecuteCmdlet(),
string.Format(Resources.CacheMismatchMessage, "WebRole1", "2.0.0"));
}
}
示例14: EnableRemoteDesktopForWebAndWorkerRoles
public void EnableRemoteDesktopForWebAndWorkerRoles()
{
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();
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole", Instances = 1 };
addNodeWorkerCmdlet.ExecuteCmdlet();
mockCommandRuntime.ResetPipelines();
EnableRemoteDesktop("user", "GoodPassword!");
// Verify the roles have been setup with forwarding, access,
// and certs
CloudServiceProject service = new CloudServiceProject(rootPath, null);
VerifyWebRole(service.Components.Definition.WebRole[0], false);
VerifyWorkerRole(service.Components.Definition.WorkerRole[0], true);
VerifyRoleSettings(service);
Assert.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count);
}
}
示例15: EnableRemoteDesktopForEmptyService
public void EnableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
Testing.AssertThrows<InvalidOperationException>(() =>
EnableRemoteDesktop("user", "GoodPassword!"));
}
}