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