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);
}
}