本文整理汇总了C#中FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的典型用法代码示例。如果您正苦于以下问题:C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的具体用法?C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings怎么用?C# FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystemHelper
的用法示例。
在下文中一共展示了FileSystemHelper.CreateAzureSdkDirectoryAndImportPublishSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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));
}
}
示例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]);
}
}
示例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);
}
}
示例5: DisableRemoteDesktopForEmptyService
public void DisableRemoteDesktopForEmptyService()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
files.CreateNewService("NEW_SERVICE");
disableRDCmdlet.DisableRemoteDesktop();
}
}
示例6: DisableRemoteDesktopForWebRole
public void DisableRemoteDesktopForWebRole()
{
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
string root = files.CreateNewService("NEW_SERVICE");
new AddAzureNodeWebRoleCommand().AddAzureNodeWebRoleProcess("WebRole", 1, root);
new DisableAzureServiceProjectRemoteDesktopCommand().DisableRemoteDesktop();
}
}
示例7: 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, "I HAVE INVALID CHARACTERS [email protected]#$%", null, null, out serviceName));
Testing.AssertThrows<ArgumentException>(() =>
ServiceSettings.LoadDefault(null, null, null, null, "ihavevalidcharsbutimjustwaytooooooooooooooooooooooooooooooooooooooooolong", null, null, out serviceName));
}
}
示例8: GetDefaultLocationWithWithRandomLocation
public void GetDefaultLocationWithWithRandomLocation()
{
// 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.IsTrue(settings.Location.Equals(ArgumentConstants.Locations[Location.WestUS]) ||
settings.Location.Equals(ArgumentConstants.Locations[Location.EastUS]));
}
}
示例9: 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.AreEqual<string>(unknownLocation.ToLower(), settings.Location.ToLower());
}
}
示例10: 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, "My-Custom-Service!", null, out serviceName);
Assert.AreEqual("myx2dcustomx2dservicex21", settings.StorageAccountName);
settings = ServiceSettings.LoadDefault(null, null, null, null, null, "MyCustomServiceIsWayTooooooooooooooooooooooooLong", null, out serviceName);
Assert.AreEqual("mycustomserviceiswaytooo", settings.StorageAccountName);
}
}
示例11: 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.AreEqual<int>(0, mockCommandRuntime.OutputPipeline.Count);
cloudServiceClientMock.Verify(f => f.StartCloudService(serviceName, slot), Times.Once());
}
}
示例12: 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.AreEqual<string>(string.Format(Resources.PackageCreated, packagePath), mockCommandRuntime.VerboseStream[0]);
Assert.AreEqual<string>(packagePath, obj.GetVariableValue<string>(Parameters.PackagePath));
Assert.IsTrue(File.Exists(packagePath));
}
}
示例13: SetupTest
public void SetupTest()
{
helper = new FileSystemHelper(this);
helper.CreateAzureSdkDirectoryAndImportPublishSettings();
WebSpacesFile = Path.Combine(GlobalPathInfo.GlobalSettingsDirectory,
string.Format("spaces.{0}.json", SubscriptionName));
SitesFile = Path.Combine(GlobalPathInfo.GlobalSettingsDirectory,
string.Format("sites.{0}.json", SubscriptionName));
if (File.Exists(WebSpacesFile))
{
File.Delete(WebSpacesFile);
}
if (File.Exists(SitesFile))
{
File.Delete(SitesFile);
}
}
示例14: SetDeploymentStatusProcessTest
public void SetDeploymentStatusProcessTest()
{
SimpleServiceManagement channel = new SimpleServiceManagement();
string newStatus = DeploymentStatus.Running;
string currentStatus = DeploymentStatus.Suspended;
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);
string result = new StartAzureService(channel).SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionName[0], serviceName);
Assert.IsTrue(statusUpdated);
}
}
示例15: SetDeploymentStatusProcessTest
public void SetDeploymentStatusProcessTest()
{
string newStatus = DeploymentStatus.Suspended;
string currentStatus = DeploymentStatus.Running;
bool statusUpdated = false;
channel.UpdateDeploymentStatusBySlotThunk = ar =>
{
statusUpdated = true;
channel.GetDeploymentBySlotThunk = ar2 => new Deployment(serviceName, slot, newStatus);
};
channel.GetDeploymentBySlotThunk = ar => new Deployment(serviceName, slot, currentStatus);
channel.IsDNSAvailableThunk = ida => new AvailabilityResponse { Result = false };
using (FileSystemHelper files = new FileSystemHelper(this))
{
files.CreateAzureSdkDirectoryAndImportPublishSettings();
AzureService service = new AzureService(files.RootPath, serviceName, null);
stopServiceCmdlet.SetDeploymentStatusProcess(service.Paths.RootPath, newStatus, slot, Data.ValidSubscriptionNames[0], serviceName);
Assert.IsTrue(statusUpdated);
}
}