2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
5
// <version>$Revision$</version>
9
using System.Collections.Generic;
10
using System.Diagnostics;
12
using ICSharpCode.Core;
13
using ICSharpCode.UnitTesting;
15
namespace Gallio.SharpDevelop
17
public class GallioEchoConsoleApplication
19
string fileName = String.Empty;
20
SelectedTests selectedTests;
21
StringBuilder commandLine = new StringBuilder();
22
List<TestRunnerExtensionCommandLineArgument> testRunnerExtensions =
23
new List<TestRunnerExtensionCommandLineArgument>();
25
public GallioEchoConsoleApplication(SelectedTests selectedTests, string fileName)
27
this.selectedTests = selectedTests;
28
this.fileName = fileName;
31
public GallioEchoConsoleApplication(SelectedTests selectedTests)
32
: this(selectedTests, String.Empty)
36
public string FileName {
37
get { return fileName; }
40
public List<TestRunnerExtensionCommandLineArgument> TestRunnerExtensions {
41
get { return testRunnerExtensions; }
44
public string GetArguments()
46
AppendDotNet4Framework();
47
AppendTestRunnerExtensions();
48
AppendAssemblyToTest();
50
return commandLine.ToString().TrimEnd();
53
void AppendDotNet4Framework()
55
AppendArgument("/rv:v4.0.30319");
59
void AppendTestRunnerExtensions()
61
foreach (TestRunnerExtensionCommandLineArgument arg in testRunnerExtensions) {
62
AppendArgument(arg.ToString());
66
void AppendArgument(string argument)
68
commandLine.Append(argument);
69
commandLine.Append(' ');
72
void AppendAssemblyToTest()
74
AppendQuoted(selectedTests.Project.OutputAssemblyFullPath);
77
void AppendQuoted(string argument)
79
commandLine.AppendFormat("\"{0}\"", argument);
82
public ProcessStartInfo GetProcessStartInfo()
84
ProcessStartInfo startInfo = new ProcessStartInfo();
85
startInfo.FileName = fileName;
86
startInfo.Arguments = GetArguments();
87
startInfo.WorkingDirectory = GetWorkingDirectory();
91
string GetWorkingDirectory()
93
return StringParser.Parse("${addinpath:ICSharpCode.Gallio}");