[mono/monodevelop] 5837332c: [NUnit] GuiUnit as a project reference now works

"Alan McGovern ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141e8eaf51a-f27c88ef-d4b1-4276-823c-5ee069c20365-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/b39f68fa0056...5837332ce239

   Commit: 5837332ce23918cf1dc2862371c9508cddfdea4c
   Author: Alan McGovern <[email protected]> (alanmcgovern)
     Date: 2013-10-24 05:22:29 GMT
      URL: https://github.com/mono/monodevelop/commit/5837332ce23918cf1dc2862371c9508cddfdea4c

[NUnit] GuiUnit as a project reference now works

I figured out a way to get the output filename for GuiUnit.exe
so i can now give that as the custom command when no other custom
command is supplied.

This means that both a direct binary reference on guiunit.exe and
also a project reference on it's csproj both result in your test
assembly being run using guiunit.exe

Changed paths:
  M main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs

Modified: main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs
===================================================================
@@ -64,7 +64,7 @@ public NUnitProjectTestSuite (DotNetProject project): base (project.Name, projec
 		public static NUnitProjectTestSuite CreateTest (DotNetProject project)
 		{
 			foreach (var p in project.References)
-				if (p.Reference.IndexOf ("GuiUnit") != -1 || p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1)
+				if (p.Reference.IndexOf ("GuiUnit", StringComparison.OrdinalIgnoreCase) != -1 || p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1)
 					return new NUnitProjectTestSuite (project);
 			return null;
 		}
@@ -134,10 +134,17 @@ public override void GetCustomConsoleRunner (out string command, out string args
 			command = r != null ? project.BaseDirectory.Combine (r.ToString ()).ToString () : null;
 			args = (string)project.ExtendedProperties ["TestRunnerArgs"];
 			if (command == null && args == null) {
-				var guiUnit = project.References.FirstOrDefault (pref => pref.ReferenceType == ReferenceType.Assembly && Path.GetFileName (pref.Reference) == "GuiUnit.exe");
+				var guiUnit = project.References.FirstOrDefault (pref => pref.ReferenceType == ReferenceType.Assembly && StringComparer.OrdinalIgnoreCase.Equals (Path.GetFileName (pref.Reference), "GuiUnit.exe"));
 				if (guiUnit != null) {
 					command = guiUnit.Reference;
 				}
+
+				var projectReference = project.References.FirstOrDefault (pref => pref.ReferenceType == ReferenceType.Project && pref.Reference.StartsWith ("GuiUnit", StringComparison.OrdinalIgnoreCase));
+				if (IdeApp.IsInitialized && command == null && projectReference != null) {
+					var guiUnitProject = IdeApp.Workspace.GetAllProjects ().First (f => f.Name == projectReference.Reference);
+					if (guiUnitProject != null)
+						command = guiUnitProject.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration);
+				}
 			}
 		}
 


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.