1 // ****************************************************************
\r
2 // Copyright 2007, Charlie Poole
\r
3 // This is free software licensed under the NUnit license. You may
\r
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
\r
5 // ****************************************************************
\r
9 using System.Diagnostics;
\r
10 using System.Reflection;
\r
11 using System.Runtime.Remoting;
\r
12 using System.Runtime.Remoting.Proxies;
\r
13 using System.Runtime.Remoting.Services;
\r
14 using System.Runtime.Remoting.Channels;
\r
15 using System.Runtime.Remoting.Channels.Tcp;
\r
18 namespace NUnit.Util
\r
21 /// Summary description for ProcessRunner.
\r
23 public class ProcessRunner : ProxyTestRunner, IDisposable
\r
25 private TestAgent agent;
\r
27 #region Constructors
\r
28 public ProcessRunner() : base( 0 ) { }
\r
30 public ProcessRunner( int runnerID ) : base( runnerID ) { }
\r
33 public override bool Load(TestPackage package)
\r
35 if ( this.agent == null )
\r
36 this.agent = Services.TestAgency.GetAgent( AgentType.ProcessAgent, 5000 );
\r
38 if ( this.TestRunner == null )
\r
39 this.TestRunner = agent.CreateRunner(this.runnerID);
\r
41 return base.Load (package);
\r
44 #region IDisposable Members
\r
45 public void Dispose()
\r
47 if ( TestRunner != null )
\r
48 this.TestRunner.Unload();
\r
50 if ( this.agent != null )
\r
51 Services.TestAgency.ReleaseAgent(this.agent);
\r
53 this.TestRunner = null;
\r