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 // ****************************************************************
8 using System
.Collections
;
14 /// Summary description for MultipleTestDomainRunner.
16 public class MultipleTestDomainRunner
: AggregatingTestRunner
19 public MultipleTestDomainRunner() : base( 0 ) { }
21 public MultipleTestDomainRunner( int runnerID
) : base( runnerID
) { }
24 #region Load Method Overrides
25 public override bool Load(TestPackage package
)
27 this.projectName
= package
.FullName
;
28 this.testName
.FullName
= this.testName
.Name
= projectName
;
29 runners
= new ArrayList();
34 string targetAssemblyName
= null;
35 if( package
.TestName
!= null && package
.Assemblies
.Contains( package
.TestName
) )
37 targetAssemblyName
= package
.TestName
;
38 package
.TestName
= null;
41 foreach( string assembly
in package
.Assemblies
)
43 if ( targetAssemblyName
== null || targetAssemblyName
== assembly
)
45 TestDomain runner
= new TestDomain( this.runnerID
* 100 + index
+ 1 );
47 TestPackage p
= new TestPackage( assembly
);
48 p
.AutoBinPath
= package
.AutoBinPath
;
49 p
.ConfigurationFile
= package
.ConfigurationFile
;
50 p
.BasePath
= package
.BasePath
;
51 p
.PrivateBinPath
= package
.PrivateBinPath
;
52 p
.TestName
= package
.TestName
;
53 foreach( object key
in package
.Settings
.Keys
)
54 p
.Settings
[key
] = package
.Settings
[key
];
56 if ( package
.TestName
== null )
58 runners
.Add( runner
);
59 if ( runner
.Load( p
) )
62 else if ( runner
.Load( p
) )
64 runners
.Add( runner
);
70 if ( package
.TestName
== null && targetAssemblyName
== null )
71 return nfound
== package
.Assemblies
.Count
;
76 private void CreateRunners( int count
)
78 runners
= new ArrayList();
79 for( int index
= 0; index
< count
; index
++ )
81 TestDomain runner
= new TestDomain( this.runnerID
* 100 + index
+ 1 );
82 runners
.Add( runner
);