public void NewAzureRoleTemplateWithRunningOutsideDefaultDirectory() { string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "TestDir", "WebRoleTemplate"); addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Web = true, CommandRuntime = mockCommandRuntime }; string originalDir = Directory.GetCurrentDirectory(); Directory.CreateDirectory("TestDir"); Directory.SetCurrentDirectory("TestDir"); try { addTemplateCmdlet.ExecuteCmdlet(); Assert.Equal <string>( outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.Path)); Testing.AssertDirectoryIdentical( Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Resources.GeneralScaffolding, RoleType.WebRole.ToString())), outputPath); } finally { Directory.SetCurrentDirectory(originalDir); } }
public void NewAzureRoleTemplateWithWorkerRole() { string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "WorkerRoleTemplate"); addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Worker = true, CommandRuntime = mockCommandRuntime }; addTemplateCmdlet.ExecuteCmdlet(); Assert.AreEqual<string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.Path)); Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath); }
public void NewAzureRoleTemplateWithOutputPath() { using (FileSystemHelper files = new FileSystemHelper(this)) { string outputPath = files.RootPath; addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Worker = true, CommandRuntime = mockCommandRuntime, Output = outputPath }; addTemplateCmdlet.ExecuteCmdlet(); Assert.AreEqual<string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.Path)); Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath); } }
public void NewAzureRoleTemplateWithWorkerRole() { string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "WorkerRoleTemplate"); addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Worker = true, CommandRuntime = mockCommandRuntime }; addTemplateCmdlet.ExecuteCmdlet(); Assert.Equal <string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.Path)); Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath); }
public void NewAzureRoleTemplateWithOutputPath() { using (FileSystemHelper files = new FileSystemHelper(this)) { string outputPath = files.RootPath; addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Worker = true, CommandRuntime = mockCommandRuntime, Output = outputPath }; addTemplateCmdlet.ExecuteCmdlet(); Assert.Equal <string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.Path)); Testing.AssertDirectoryIdentical(Path.Combine(Resources.GeneralScaffolding, RoleType.WorkerRole.ToString()), outputPath); } }
public void NewAzureRoleTemplateWithWebRole() { string outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WebRoleTemplate"); TestMockSupport.TestExecutionFolder = AppDomain.CurrentDomain.BaseDirectory; addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Web = true, CommandRuntime = mockCommandRuntime }; addTemplateCmdlet.ExecuteCmdlet(); Assert.Equal <string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.Path)); Testing.AssertDirectoryIdentical( Path.Combine( AppDomain.CurrentDomain.BaseDirectory, Resources.GeneralScaffolding, RoleType.WebRole.ToString()), outputPath); }
public void NewAzureRoleTemplateWithRunningOutsideDefaultDirectory() { string outputPath = Path.Combine(Directory.GetCurrentDirectory(), "TestDir", "WebRoleTemplate"); addTemplateCmdlet = new NewAzureRoleTemplateCommand() { Web = true, CommandRuntime = mockCommandRuntime }; string originalDir = Directory.GetCurrentDirectory(); Directory.CreateDirectory("TestDir"); Directory.SetCurrentDirectory("TestDir"); try { addTemplateCmdlet.ExecuteCmdlet(); Assert.AreEqual<string>(outputPath, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue<string>(Parameters.Path)); Testing.AssertDirectoryIdentical(Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), Resources.GeneralScaffolding, RoleType.WebRole.ToString())), outputPath); } finally { Directory.SetCurrentDirectory(originalDir); } }