本文整理汇总了C#中Microsoft.WindowsAzure.Commands.Test.Utilities.Common.FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的具体用法?C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings怎么用?C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Commands.Test.Utilities.Common.FileSystemHelper
的用法示例。
在下文中一共展示了FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisableRemoteDesktopForEmptyService
public void DisableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
disableRDCmdlet.DisableRemoteDesktop();
}
}
示例2: 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();
}
}
示例3: 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));
}
}
示例4: 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());
}
}
示例5: 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);
}
}
示例6: 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));
}
}
示例7: 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);
CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath(@"..\..\..\..\..\Package\Debug\ServiceManagement\Azure\Services"));
service.AddWebRole(Test.Utilities.Common.Data.NodeWebRoleScaffoldingPath);
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));
}
}
示例8: CacheTests
public CacheTests()
{
helper = new FileSystemHelper(this);
helper.CreateAzureSdkDirectoryAndImportPublishSettings();
WebSpacesFile = Path.Combine(AzurePowerShell.ProfileDirectory,
string.Format("spaces.{0}.json", SubscriptionName));
SitesFile = Path.Combine(AzurePowerShell.ProfileDirectory,
string.Format("sites.{0}.json", SubscriptionName));
if (File.Exists(WebSpacesFile))
{
File.Delete(WebSpacesFile);
}
if (File.Exists(SitesFile))
{
File.Delete(SitesFile);
}
}
示例9: EnableRemoteDesktopBasicParameterValidation
public void EnableRemoteDesktopBasicParameterValidation()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop(null, null));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop(string.Empty, string.Empty));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", null));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", string.Empty));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", "short"));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", "onlylower"));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", "ONLYUPPER"));
Testing.AssertThrows<ArgumentException>(
() => EnableRemoteDesktop("user", "1234567890"));
}
}
示例10: GetDefaultLocationWithUnknwonLocation
public void GetDefaultLocationWithUnknwonLocation()
{
// 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;
string unknownLocation = "Unknown Location";
ServiceSettings settings = ServiceSettings.LoadDefault(null, null, unknownLocation, null, null, null, "My-Custom-Service!", null, out serviceName);
Assert.Equal<string>(unknownLocation.ToLower(), settings.Location.ToLower());
}
}
示例11: TestUpgradeCloudServiceFromAPackage
public void TestUpgradeCloudServiceFromAPackage()
{
clientMocks.ComputeManagementClientMock.Setup(
c =>
c.HostedServices.CreateAsync(It.IsAny<HostedServiceCreateParameters>(), It.IsAny<CancellationToken>()))
.Returns(Tasks.FromResult(new OperationResponse
{
RequestId = "request001",
StatusCode = HttpStatusCode.OK
}));
clientMocks.ComputeManagementClientMock.Setup(
c =>
c.Deployments.UpgradeBySlotAsync(It.IsAny<string>(), DeploymentSlot.Production,
It.IsAny<DeploymentUpgradeParameters>(),
It.IsAny<CancellationToken>()))
.Returns(Tasks.FromResult(CreateComputeOperationResponse("req002")));
clientMocks.ManagementClientMock.Setup(c => c.Locations.ListAsync(It.IsAny<CancellationToken>()))
.Returns(Tasks.FromResult(new LocationsListResponse
{
Locations =
{
new LocationsListResponse.Location {DisplayName = "East US", Name = "EastUS"}
}
}));
using (var files = new FileSystemHelper(this) { EnableMonitoring = true })
{
// Setup
string packageName = serviceName;
string package, configuration;
files.CreateDirectoryWithPrebuiltPackage(packageName, out package, out configuration);
files.CreateAzureSdkDirectoryAndImportPublishSettings();
// Execute
ExecuteInTempCurrentDirectory(Path.GetDirectoryName(package),
() => client.PublishCloudService(package, configuration, null, null, null, null, null, false, false));
// Verify
clientMocks.ComputeManagementClientMock.Verify(c => c.Deployments.UpgradeBySlotAsync(serviceName,
DeploymentSlot.Production, It.IsAny<DeploymentUpgradeParameters>(), It.IsAny<CancellationToken>()), Times.Once);
}
}
示例12: EnableRemoteDesktopForEmptyService
public void EnableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
Testing.AssertThrows<InvalidOperationException>(() =>
EnableRemoteDesktop("user", "GoodPassword!"));
}
}
示例13: TestUpgradeCloudService
public void TestUpgradeCloudService()
{
clientMocks.ComputeManagementClientMock.Setup(
c =>
c.HostedServices.CreateAsync(It.IsAny<HostedServiceCreateParameters>(), It.IsAny<CancellationToken>()))
.Returns(Tasks.FromResult(new OperationResponse
{
RequestId = "request001",
StatusCode = HttpStatusCode.OK
}));
clientMocks.ComputeManagementClientMock.Setup(
c =>
c.Deployments.UpgradeBySlotAsync(It.IsAny<string>(), DeploymentSlot.Production,
It.IsAny<DeploymentUpgradeParameters>(),
It.IsAny<CancellationToken>()))
.Returns(Tasks.FromResult(CreateComputeOperationResponse("req002")));
using (var files = new FileSystemHelper(this) { EnableMonitoring = true })
{
// Setup
string rootPath = files.CreateNewService(serviceName);
files.CreateAzureSdkDirectoryAndImportPublishSettings();
var cloudServiceProject = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath("Services"));
cloudServiceProject.AddWebRole(Test.Utilities.Common.Data.NodeWebRoleScaffoldingPath);
ExecuteInTempCurrentDirectory(rootPath, () => client.PublishCloudService(location: "West US"));
clientMocks.ComputeManagementClientMock.Verify(c => c.Deployments.UpgradeBySlotAsync(serviceName, DeploymentSlot.Production, It.IsAny<DeploymentUpgradeParameters>(), It.IsAny<CancellationToken>()), Times.Once);
}
}
示例14: EnableRemoteDesktopForMultipleWebAndWorkerRolesTwice
public void EnableRemoteDesktopForMultipleWebAndWorkerRolesTwice()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
string rootPath = files.CreateNewService("NEW_SERVICE");
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole_1", Instances = 1 };
addNodeWebCmdlet.ExecuteCmdlet();
addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole_2", Instances = 1 };
addNodeWebCmdlet.ExecuteCmdlet();
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole_1", Instances = 1 };
addNodeWorkerCmdlet.ExecuteCmdlet();
addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole_2", Instances = 1 };
addNodeWorkerCmdlet.ExecuteCmdlet();
mockCommandRuntime.ResetPipelines();
enableRDCmdlet.PassThru = true;
EnableRemoteDesktop("user", "GoodPassword!");
enableRDCmdlet.PassThru = false;
EnableRemoteDesktop("other", "OtherPassword!");
// Verify the roles have been setup with forwarding, access,
// and certs
CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath(@"..\..\..\..\..\Package\Debug\ServiceManagement\Azure\Services"));
VerifyWebRole(service.Components.Definition.WebRole[0], false);
VerifyWebRole(service.Components.Definition.WebRole[0], false);
VerifyWorkerRole(service.Components.Definition.WorkerRole[0], true);
VerifyWorkerRole(service.Components.Definition.WorkerRole[1], false);
VerifyRoleSettings(service);
Assert.Equal<int>(1, mockCommandRuntime.OutputPipeline.Count);
Assert.True((bool)mockCommandRuntime.OutputPipeline[0]);
}
}
示例15: EnableRemoteDesktopUnicode
public void EnableRemoteDesktopUnicode()
{
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();
EnableRemoteDesktop("㯑䲘䄂㮉", "㯑䲘䄂㮉㮉㮉㮉L");
// Verify the role has been setup with forwarding, access,
// and certs
CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath(@"..\..\..\..\..\Package\Debug\ServiceManagement\Azure\Services"));
VerifyWebRole(service.Components.Definition.WebRole[0], true);
VerifyRoleSettings(service);
}
}