private ITestRunner CreateTestRunner(TestRunnerKey key)
 {
     var container = TestRunContainerBuilder.CreateContainer();
     if (key.Async)
     {
         //TODO: better support this in the DI container
         container.RegisterTypeAs<AsyncTestRunner, ITestRunner>();
     }
     var factory = container.Resolve<ITestRunnerFactory>();
     return factory.Create(key.TestAssembly);
 }
Esempio n. 2
0
 public bool Equals(TestRunnerKey other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.TestAssembly, TestAssembly) && other.Async.Equals(Async));
 }
Esempio n. 3
0
        private ITestRunner CreateTestRunner(TestRunnerKey key)
        {
            var container = TestRunContainerBuilder.CreateContainer();

            if (key.Async)
            {
                //TODO: better support this in the DI container
                container.RegisterTypeAs <AsyncTestRunner, ITestRunner>();
            }
            var factory = container.Resolve <ITestRunnerFactory>();

            return(factory.Create(key.TestAssembly));
        }
 private ITestRunner GetTestRunner(TestRunnerKey key)
 {
     ITestRunner testRunner;
     if (!testRunnerRegistry.TryGetValue(key, out testRunner))
     {
         lock(syncRoot)
         {
             if (!testRunnerRegistry.TryGetValue(key, out testRunner))
             {
                 testRunner = CreateTestRunner(key);
                 testRunnerRegistry.Add(key, testRunner);
             }
         }
     }
     return testRunner;
 }
Esempio n. 5
0
        private ITestRunner GetTestRunner(TestRunnerKey key)
        {
            ITestRunner testRunner;

            if (!testRunnerRegistry.TryGetValue(key, out testRunner))
            {
                lock (syncRoot)
                {
                    if (!testRunnerRegistry.TryGetValue(key, out testRunner))
                    {
                        testRunner = CreateTestRunner(key);
                        testRunnerRegistry.Add(key, testRunner);
                    }
                }
            }
            return(testRunner);
        }
 public bool Equals(TestRunnerKey other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.TestAssembly, TestAssembly) && other.Async.Equals(Async);
 }