Author: lluis
Date: 2006-05-31 10:29:28 -0400 (Wed, 31 May 2006)
New Revision: 61330

Modified:
   trunk/monodevelop/Extras/NUnit/ChangeLog
   trunk/monodevelop/Extras/NUnit/MonoDevelopNUnit.addin.xml
   trunk/monodevelop/Extras/NUnit/Services/NUnitService.cs
Log:
2006-05-31 Lluis Sanchez Gual  <[EMAIL PROTECTED]>

        * MonoDevelopNUnit.addin.xml:
        * Services/NUnitService.cs: Added an extension point for registering
          test providers. It replaces the RegisterTestProvider api call.



Modified: trunk/monodevelop/Extras/NUnit/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/NUnit/ChangeLog    2006-05-31 14:14:29 UTC (rev 
61329)
+++ trunk/monodevelop/Extras/NUnit/ChangeLog    2006-05-31 14:29:28 UTC (rev 
61330)
@@ -1,3 +1,9 @@
+2006-05-31 Lluis Sanchez Gual  <[EMAIL PROTECTED]>
+
+       * MonoDevelopNUnit.addin.xml:
+       * Services/NUnitService.cs: Added an extension point for registering
+         test providers. It replaces the RegisterTestProvider api call.
+
 2006-05-04 Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * MonoDevelopNUnit.addin.xml: Updated versions.

Modified: trunk/monodevelop/Extras/NUnit/MonoDevelopNUnit.addin.xml
===================================================================
--- trunk/monodevelop/Extras/NUnit/MonoDevelopNUnit.addin.xml   2006-05-31 
14:14:29 UTC (rev 61329)
+++ trunk/monodevelop/Extras/NUnit/MonoDevelopNUnit.addin.xml   2006-05-31 
14:29:28 UTC (rev 61330)
@@ -119,4 +119,10 @@
                            
class="MonoDevelop.NUnit.NUnitAssemblyGroupFileFormat, MonoDevelop.NUnit"/>
        </Extension>
 
+       <!-- New extension points -->
+
+       <Extension path = "/Services/NUnit/TestProviders" 
extension-nodes="Class" description="Test providers.|Specified classes must 
implement ITestProvider.">
+               <Class id = "SystemTestProvider" class = 
"MonoDevelop.NUnit.SystemTestProvider"/>
+       </Extension>
+
 </AddIn>

Modified: trunk/monodevelop/Extras/NUnit/Services/NUnitService.cs
===================================================================
--- trunk/monodevelop/Extras/NUnit/Services/NUnitService.cs     2006-05-31 
14:14:29 UTC (rev 61329)
+++ trunk/monodevelop/Extras/NUnit/Services/NUnitService.cs     2006-05-31 
14:29:28 UTC (rev 61330)
@@ -42,7 +42,7 @@
 {
        public class NUnitService : AbstractService
        {
-               ArrayList providers = new ArrayList ();
+               ITestProvider[] providers;
                UnitTest rootTest;
                Pad resultsPad;
                
@@ -52,13 +52,26 @@
                
                public override void InitializeService ()
                {
-                       RegisterTestProvider (new SystemTestProvider ());
                        IdeApp.ProjectOperations.CombineOpened += 
(CombineEventHandler) MonoDevelop.Core.Gui.Services.DispatchService.GuiDispatch 
(new CombineEventHandler (OnOpenCombine));
                        IdeApp.ProjectOperations.CombineClosed += 
(CombineEventHandler) MonoDevelop.Core.Gui.Services.DispatchService.GuiDispatch 
(new CombineEventHandler (OnCloseCombine));
                        
                        IProjectService ps = 
MonoDevelop.Projects.Services.ProjectService;
                        ps.DataContext.IncludeType (typeof(UnitTestOptionsSet));
                        ps.DataContext.RegisterProperty 
(typeof(AbstractConfiguration), "UnitTestInformation", 
typeof(UnitTestOptionsSet));
+                       
+                       providers = (ITestProvider[]) 
Runtime.AddInService.GetTreeItems ("/Services/NUnit/TestProviders", 
typeof(ITestProvider));
+                       foreach (ITestProvider provider in providers) {
+                               Type[] types = provider.GetOptionTypes ();
+                               if (types != null) {
+                                       foreach (Type t in types) {
+                                               if 
(!typeof(ICloneable).IsAssignableFrom (t)) {
+                                                       Console.WriteLine 
("Option types must implement ICloneable: " + t);
+                                                       continue;
+                                               }
+                                               ps.DataContext.IncludeType (t);
+                                       }
+                               }
+                       }
                }
                
                public IAsyncOperation RunTest (UnitTest test)
@@ -131,20 +144,6 @@
                        get { return rootTest; }
                }
                
-               public void RegisterTestProvider (ITestProvider provider)
-               {
-                       providers.Add (provider);
-                       Type[] types = provider.GetOptionTypes ();
-                       if (types != null) {
-                               foreach (Type t in types) {
-                                       if 
(!typeof(ICloneable).IsAssignableFrom (t))
-                                               throw new 
InvalidOperationException ("Option types must implement ICloneable: " + t);
-                                       IProjectService ps = 
MonoDevelop.Projects.Services.ProjectService;
-                                       ps.DataContext.IncludeType (t);
-                               }
-                       }
-               }
-               
                public static void ShowOptionsDialog (UnitTest test)
                {
                        UnitTestOptionsDialog optionsDialog = new 
UnitTestOptionsDialog (IdeApp.Workbench.RootWindow, test);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to