static void Main(string[] args) { try { EndpointAddress ea = new EndpointAddress(string.Concat( TestRunnerServiceConfig.Uri, "/", TestRunnerServiceConfig.PipeName)); ITestRunnerService server = ChannelFactory <ITestRunnerService> .CreateChannel(new BasicHttpBinding(), ea); try { string assembly = server.GetAssembly(); string nspace = server.GetNamespace(); string type = server.GetTypeName(); string method = server.GetMethod(); ExternalTestRunner etr = new ExternalTestRunner(); etr.BeginRun(server, assembly, nspace, type, method); } catch (Exception ex) { server.ReportError(ex); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void Run() { string basePath = Path.GetDirectoryName(_assembly); AppDomainSetup ads = new AppDomainSetup(); ads.PrivateBinPath = basePath; ads.ApplicationBase = basePath; ads.ConfigurationFile = string.Concat(Path.GetFileName(_assembly), ".config"); AppDomain domain = AppDomain.CreateDomain("External Test Run", null, ads); // TODO use assembly resolver to load assemblies instead of copying locally. //Type t = typeof( RunClient ); //string copyAssembly = Path.Combine( basePath, Path.GetFileName( t.Assembly.Location ) ); //File.Copy( t.Assembly.Location, copyAssembly, true ); try { //_listener = (RunClient)domain.CreateInstanceAndUnwrap( t.Assembly.FullName, t.FullName ); //_listener.Run( _assembly, _namespace, _type, _method ); Run(_assembly, _namespace, _type, _method); } catch (Exception ex) { _service.ReportError(ex); } finally { //try //{ // File.Delete( copyAssembly ); //} //catch( Exception ex ) //{ // _service.ReportError( ex ); //} } _service.TestComplete(_timer.ElapsedMilliseconds); }