public DirectTestRunner(IServiceLocator services, TestPackage package) : base(services, package) { // Bypass the resolver if not in the default AppDomain. This prevents trying to use the resolver within // NUnit's own automated tests (in a test AppDomain) which does not make sense anyway. if (AppDomain.CurrentDomain.IsDefaultAppDomain()) { _assemblyResolver = new ProvidedPathsAssemblyResolver(); _assemblyResolver.Install(); } }
public TestAgentRunner(TestPackage package) : base(package) { Guard.ArgumentNotNull(package, nameof(package)); Guard.ArgumentValid(package.SubPackages.Count == 0, "Only one assembly may be loaded by an agent", nameof(package)); Guard.ArgumentValid(package.FullName != null, "Package may not be anonymous", nameof(package)); Guard.ArgumentValid(package.IsAssemblyPackage(), "Must be an assembly package", nameof(package)); // Bypass the resolver if not in the default AppDomain. This prevents trying to use the resolver within // NUnit's own automated tests (in a test AppDomain) which does not make sense anyway. if (AppDomain.CurrentDomain.IsDefaultAppDomain()) { _assemblyResolver = new ProvidedPathsAssemblyResolver(); _assemblyResolver.Install(); } }
/// <summary> /// Gets a driver for a given test assembly and a framework /// which the assembly is already known to reference. /// </summary> /// <param name="domain">The domain in which the assembly will be loaded</param> /// <param name="reference">The name of the test framework reference</param> /// <returns></returns> public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference) { if (!IsSupportedTestFramework(reference)) { throw new ArgumentException("Invalid framework", "reference"); } if (!_resolverInstalled) { _resolver.Install(); _resolverInstalled = true; _resolver.AddPathFromFile(_driverNode.AssemblyPath); } return(_driverNode.CreateExtensionObject(domain) as IFrameworkDriver); }