/// <summary> /// Initialize our model of the AzureService located at the given /// path along with its DeploymentSettings and SubscriptionId. /// </summary> /// <param name="rootPath">Root path of the Azure service.</param> internal void InitializeSettingsAndCreatePackage(string rootPath) { Debug.Assert(!string.IsNullOrEmpty(rootPath), "rootPath cannot be null or empty."); Debug.Assert(Directory.Exists(rootPath), "rootPath does not exist."); _azureService = new AzureService(rootPath, null); // If user provided a service name, change current service name to use it. // if (!string.IsNullOrEmpty(Name)) { _azureService.ChangeServiceName(Name, _azureService.Paths); } ServiceSettings defaultSettings = ServiceSettings.LoadDefault( _azureService.Paths.Settings, Slot, Location, Subscription, StorageAccountName, Name, _azureService.ServiceName, out _hostedServiceName); subscriptionId = new GlobalComponents(GlobalPathInfo.GlobalSettingsDirectory) .GetSubscriptionId(defaultSettings.Subscription); SafeWriteObjectWithTimestamp(String.Format(Resources.PublishPreparingDeploymentMessage, _hostedServiceName, subscriptionId)); CreatePackage(); _deploymentSettings = new DeploymentSettings( defaultSettings, _azureService.Paths.CloudPackage, _azureService.Paths.CloudConfiguration, _hostedServiceName, string.Format(Resources.ServiceDeploymentName, defaultSettings.Slot)); }
public void ChangeServiceNameTest() { string newName = "NodeAppService"; using (FileSystemHelper files = new FileSystemHelper(this)) { AzureService service = new AzureService(files.RootPath, serviceName, null); service.ChangeServiceName(newName, service.Paths); Assert.AreEqual<string>(newName, service.Components.CloudConfig.serviceName); Assert.AreEqual<string>(newName, service.Components.LocalConfig.serviceName); Assert.AreEqual<string>(newName, service.Components.Definition.name); } }