示例#1
0
        public NUnit2FrameworkDriver(AppDomain testDomain, string frameworkAssemblyName, string testAssemblyPath, IDictionary <string, object> settings)
        {
            if (!File.Exists(testAssemblyPath))
            {
                throw new ArgumentException("testAssemblyPath", "Framework driver constructor called with a file name that doesn't exist.");
            }

            _testDomain            = testDomain;
            _testAssemblyPath      = testAssemblyPath;
            _frameworkAssemblyName = frameworkAssemblyName;

            _name     = Escape(Path.GetFileName(_testAssemblyPath));
            _fullname = Escape(_testAssemblyPath);

            var initializer = DomainInitializer.CreateInstance(_testDomain);

            initializer.InitializeDomain((int)InternalTrace.Level);

            _runner = RemoteTestRunner.CreateInstance(_testDomain, 1);

            _package = new Core.TestPackage(_frameworkAssemblyName);
            foreach (var key in settings.Keys)
            {
                _package.Settings[key] = settings[key];
            }
        }
示例#2
0
        /// <summary>
        /// Create a new NUnit2FrameworkDriver
        /// </summary>
        /// <param name="testDomain">The AppDomain to use for the runner</param>
        /// <remarks>
        /// The framework assembly name is needed because this driver is used for both the
        /// nunit.framework 2.x and nunitlite 1.0.
        /// </remarks>
        public NUnit2FrameworkDriver(AppDomain testDomain)
        {
            _testDomain = testDomain;

            var initializer = DomainInitializer.CreateInstance(_testDomain);

            initializer.InitializeDomain((int)InternalTrace.Level);

            _runner = RemoteTestRunner.CreateInstance(_testDomain, 1);
        }
        private UnitTester(string testAssembly)
        {
            var testPackage = new TestPackage(Path.GetFileNameWithoutExtension(testAssembly));

            testPackage.Assemblies.Add(testAssembly);

            // Create a new appdomain with the appropriate working directory.
            // This is required so that we don't accidentially load the wrong dependencies.
            var setup = new AppDomainSetup();

            setup.ApplicationBase = Path.GetDirectoryName(testAssembly);
            domain = AppDomain.CreateDomain("TestDomain", null, setup);

            runner = RemoteTestRunner.CreateInstance(domain, 0);
            runner.Load(testPackage);
        }