diff --git a/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs b/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs index dbf6ccd1eb..cbb15dd925 100644 --- a/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs +++ b/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs @@ -129,6 +129,7 @@ namespace ICSharpCode.UnitTesting // Read the rest of the file just in case. testResultsMonitor.Stop(); testResultsMonitor.Read(); + StopMonitoring(); projects.Remove(currentProject); if (projects.Count > 0) { @@ -410,7 +411,7 @@ namespace ICSharpCode.UnitTesting protected override void RunTests(UnitTestApplicationStartHelper helper) { TestRunnerCategory.AppendLine(helper.GetCommandLine()); - runner.Start(UnitTestApplicationStartHelper.UnitTestConsoleApplication, helper.GetArguments()); + runner.Start(helper.GetUnitTestConsoleApplication(), helper.GetArguments()); } protected override void OnStop() @@ -418,6 +419,11 @@ namespace ICSharpCode.UnitTesting runner.Kill(); } + protected ProcessRunner GetProcessRunner() + { + return runner; + } + void OutputLineReceived(object source, LineReceivedEventArgs e) { TestRunnerCategory.AppendLine(e.Line); diff --git a/src/AddIns/Misc/UnitTesting/Src/TestResultsMonitor.cs b/src/AddIns/Misc/UnitTesting/Src/TestResultsMonitor.cs index 078f8a8a5f..76934cca86 100644 --- a/src/AddIns/Misc/UnitTesting/Src/TestResultsMonitor.cs +++ b/src/AddIns/Misc/UnitTesting/Src/TestResultsMonitor.cs @@ -96,7 +96,6 @@ namespace ICSharpCode.UnitTesting { string text = ReadTextAdded(); if (text != null) { - Console.WriteLine(text); TestResult[] results = testResultsReader.Read(text); OnTestResultsReceived(results); } diff --git a/src/AddIns/Misc/UnitTesting/Src/UnitTestApplicationStartHelper.cs b/src/AddIns/Misc/UnitTesting/Src/UnitTestApplicationStartHelper.cs index 3e292b1b1a..8787495167 100644 --- a/src/AddIns/Misc/UnitTesting/Src/UnitTestApplicationStartHelper.cs +++ b/src/AddIns/Misc/UnitTesting/Src/UnitTestApplicationStartHelper.cs @@ -23,6 +23,8 @@ namespace ICSharpCode.UnitTesting /// public class UnitTestApplicationStartHelper { + public const string TargetFrameworkVersionNet11 = "v1.1"; + /// /// returns full/path/to/Tools/NUnit /// @@ -32,6 +34,15 @@ namespace ICSharpCode.UnitTesting } } + /// + /// returns full/path/to/Tools/NUnit that runs under .NET 1.1. + /// + public static string UnitTestApplicationDirectoryNet11 { + get { + return Path.Combine(UnitTestApplicationDirectory, "Net-1.1"); + } + } + /// /// returns full/path/to/Tools/NUnit/nunit-console.exe /// @@ -41,6 +52,15 @@ namespace ICSharpCode.UnitTesting } } + /// + /// returns full/path/to/Tools/NUnit/nunit-console.exe that runs under .NET 1.1. + /// + public static string UnitTestConsoleApplicationNet11 { + get { + return Path.Combine(UnitTestApplicationDirectoryNet11, "nunit-console.exe"); + } + } + public readonly List Assemblies = new List(); /// @@ -117,6 +137,37 @@ namespace ICSharpCode.UnitTesting } } + /// + /// Gets the Unit Test console application filename based on the + /// target framework specified in the project. + /// + /// Deliberately using the unevaluated property since the + /// SharpDevelop build targets file changes the target version to + /// v1.0 if it is v1.1. + public static string GetUnitTestConsoleApplication(string targetFrameworkVersion) + { + switch (targetFrameworkVersion) { + case TargetFrameworkVersionNet11: + return UnitTestConsoleApplicationNet11; + default: + return UnitTestConsoleApplication; + } + } + + /// + /// Gets the Unit Test console application filename based on the + /// target framework specified in the project. + /// + /// Deliberately using the unevaluated property since the + /// SharpDevelop build targets file changes the target version to + /// v1.0 if it is v1.1. + public string GetUnitTestConsoleApplication() + { + MSBuildBasedProject msbuildBasedProject = (MSBuildBasedProject)project; + string targetFrameworkVersion = msbuildBasedProject.GetUnevalatedProperty("TargetFrameworkVersion"); + return GetUnitTestConsoleApplication(targetFrameworkVersion); + } + /// /// Gets the full command line to run the unit test application. /// This is the combination of the UnitTestConsoleApplication and @@ -124,7 +175,7 @@ namespace ICSharpCode.UnitTesting /// public string GetCommandLine() { - return String.Concat("\"", UnitTestConsoleApplication, "\" ", GetArguments()); + return String.Concat("\"", GetUnitTestConsoleApplication(), "\" ", GetArguments()); } /// diff --git a/src/AddIns/Misc/UnitTesting/Test/UnitTestCommandLineTests.cs b/src/AddIns/Misc/UnitTesting/Test/UnitTestCommandLineTests.cs index 2b01c2e3b2..a53438650f 100644 --- a/src/AddIns/Misc/UnitTesting/Test/UnitTestCommandLineTests.cs +++ b/src/AddIns/Misc/UnitTesting/Test/UnitTestCommandLineTests.cs @@ -174,5 +174,43 @@ namespace UnitTesting.Tests helper.Initialize(project, null, null); Assert.AreSame(project, helper.Project); } + + /// + /// Here the project specifies that it is to be compiled + /// against the .NET 1.1 framework so for testing we use the + /// nunit-console.exe that runs against that framework. + /// + [Test] + public void Netv11TargetFramework() + { + project.SetProperty("TargetFrameworkVersion", "v1.1"); + + helper.Initialize(project, null, null); + helper.ShadowCopy = true; + + FileUtility.ApplicationRootPath = @"C:\SharpDevelop"; + + string expectedFullCommandLine = "\"C:\\SharpDevelop\\bin\\Tools\\NUnit\\Net-1.1\\nunit-console.exe\" \"C:\\Projects\\MyTests\\MyTests.dll\""; + Assert.AreEqual(expectedFullCommandLine, helper.GetCommandLine()); + } + + /// + /// Here the project specifies that it is to be compiled + /// against the .NET 1.0 framework. We do not support .NET 1.0 + /// so we return the nunit-console that runs against .NET 2.0. + /// + [Test] + public void Netv10TargetFramework() + { + project.SetProperty("TargetFrameworkVersion", "v1.0"); + + helper.Initialize(project, null, null); + helper.ShadowCopy = true; + + FileUtility.ApplicationRootPath = @"C:\SharpDevelop"; + + string expectedFullCommandLine = "\"C:\\SharpDevelop\\bin\\Tools\\NUnit\\nunit-console.exe\" \"C:\\Projects\\MyTests\\MyTests.dll\""; + Assert.AreEqual(expectedFullCommandLine, helper.GetCommandLine()); + } } } diff --git a/src/Setup/Files.wxs b/src/Setup/Files.wxs index 6c4a98b0fe..a5812e7feb 100644 --- a/src/Setup/Files.wxs +++ b/src/Setup/Files.wxs @@ -414,6 +414,21 @@ + + + + + + + + + + + + + + + @@ -650,8 +665,8 @@ - - + + diff --git a/src/Setup/Setup.wxs b/src/Setup/Setup.wxs index 625e08000b..4aa3587d76 100644 --- a/src/Setup/Setup.wxs +++ b/src/Setup/Setup.wxs @@ -210,6 +210,10 @@ + + + + diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build index 846a5b4c86..b31e0ab264 100644 --- a/src/Tools/Tools.build +++ b/src/Tools/Tools.build @@ -6,7 +6,9 @@ - + + + @@ -18,6 +20,9 @@ + + +