public void AddAzurePHPWorkerRoleWillRecreateDeploymentSettings() { using (FileSystemHelper files = new FileSystemHelper(this)) { string roleName = "WorkerRole1"; string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); mockCommandRuntime = new MockCommandRuntime(); addPHPWorkerCmdlet = new AddAzurePHPWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime }; string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePHP, rootPath, roleName); string settingsFilePath = Path.Combine(rootPath, Resources.SettingsFileName); File.Delete(settingsFilePath); Assert.IsFalse(File.Exists(settingsFilePath)); addPHPWorkerCmdlet.ExecuteCmdlet(); AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PHPScaffolding, Resources.WorkerRole)); Assert.AreEqual <string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.RoleName)); Assert.AreEqual <string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]); Assert.IsTrue(File.Exists(settingsFilePath)); } }
public void AddAzurePHPWorkerRoleProcess() { using (FileSystemHelper files = new FileSystemHelper(this)) { string roleName = "WorkerRole1"; string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); mockCommandRuntime = new MockCommandRuntime(); addPHPWorkerCmdlet = new AddAzurePHPWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime }; string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePHP, rootPath, roleName); addPHPWorkerCmdlet.ExecuteCmdlet(); AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PHPScaffolding, Resources.WorkerRole)); Assert.AreEqual<string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.RoleName)); Assert.AreEqual<string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]); } }