NUnit.Core.TestRunner.Load(NUnit.Core.TestPackage)

Here are the examples of the csharp api NUnit.Core.TestRunner.Load(NUnit.Core.TestPackage) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

9 Examples 7

19 Source : NUnitTestRunner.cs
with MIT License
from PlasticSCM

TestRunner SetupTest(IPNUnitServices services, TestConsoleAccess consoleAccess, TestLogInfo testLogInfo)
        {
            Directory.SetCurrentDirectory(Path.GetDirectoryName(mNUnitreplacedemblyPath));

            TestPackage package = new TestPackage(Path.GetFileName(mNUnitreplacedemblyPath));

            TestRunner result = new SimpleTestRunner();

            AppDomain.CurrentDomain.replacedemblyResolve += new ResolveEventHandler(CurrentDomain_replacedemblyResolve);

            bool testLoaded = result.Load(package);

            if( !testLoaded )
            {
                mLog.InfoFormat("Unable to locate test {0}", mPNUnitTestInfo.TestName);
                PNUnitTestResult testResult = PNUnitTestRunner.BuildError(
                    mPNUnitTestInfo, new Exception("Unable to locate tests"), consoleAccess,
                    testLogInfo);

                services.NotifyResult(
                    mPNUnitTestInfo.TestName, testResult);

                return null;
            }

            InitPNUnitServices(
                mPNUnitTestInfo, result, services, consoleAccess, testLogInfo);

            return result;
        }

19 Source : PNUnitTestRunner.cs
with MIT License
from PlasticSCM

bool MakeTest(TestRunner runner, string fullreplacedemblyPath)
        {
            return runner.Load(new TestPackage(fullreplacedemblyPath));
        }

19 Source : ProxyTestRunner.cs
with MIT License
from roozbehid

public virtual bool Load( TestPackage package )
		{
			return this.testRunner.Load( package );
		}

19 Source : TestDomain.cs
with MIT License
from roozbehid

public override bool Load( TestPackage package )
		{
			Unload();

			try
			{
				if ( this.domain == null )
					this.domain = Services.DomainManager.CreateDomain( package );
            
				if ( this.TestRunner == null )
					this.TestRunner = MakeRemoteTestRunner( domain );

				return TestRunner.Load( package );
			}
			catch
			{
				Unload();
				throw;
			}
		}

19 Source : TestLoader.cs
with MIT License
from roozbehid

public void LoadTest( string testName )
		{
            long startTime = DateTime.Now.Ticks;

			try
			{
				events.FireTestLoading( TestFileName );

				testRunner = CreateRunner();

				bool loaded = testRunner.Load( MakeTestPackage( testName ) );

				loadedTest = testRunner.Test;
				loadedTestName = testName;
				testResult = null;
				reloadPending = false;
			
				if ( ReloadOnChange )
					InstallWatcher( );

				if ( loaded )
					events.FireTestLoaded( TestFileName, loadedTest );
				else
				{
					lastException = new ApplicationException( string.Format ( "Unable to find test {0} in replacedembly", testName ) );
					events.FireTestLoadFailed( TestFileName, lastException );
				}
			}
			catch( FileNotFoundException exception )
			{
				lastException = exception;

				foreach( string replacedembly in TestProject.ActiveConfig.replacedemblies )
				{
					if ( Path.GetFileNameWithoutExtension( replacedembly ) == exception.FileName &&
						!PathUtils.SamePathOrUnder( testProject.ActiveConfig.BasePath, replacedembly ) )
					{
						lastException = new ApplicationException( string.Format( "Unable to load {0} because it is not located under the AppBase", exception.FileName ), exception );
						break;
					}
				}

				events.FireTestLoadFailed( TestFileName, lastException );
			}
			catch( Exception exception )
			{
				lastException = exception;
				events.FireTestLoadFailed( TestFileName, exception );
			}

            double loadTime = (double)(DateTime.Now.Ticks - startTime) / (double)TimeSpan.TicksPerSecond;
            System.Diagnostics.Trace.WriteLine(string.Format("TestLoader: Loaded in {0} seconds", loadTime)); 
		}

19 Source : TestLoader.cs
with MIT License
from roozbehid

public void ReloadTest()
		{
			try
			{
				events.FireTestReloading( TestFileName );

				testRunner.Load( MakeTestPackage( loadedTestName ) );

				loadedTest = testRunner.Test;
				reloadPending = false;

				events.FireTestReloaded( TestFileName, loadedTest );				
			}
			catch( Exception exception )
			{
				lastException = exception;
				events.FireTestReloadFailed( TestFileName, exception );
			}
		}

19 Source : TestLoadFixture.cs
with MIT License
from roozbehid

protected void LoadAndRunTestreplacedembly( fit.Parse cell, string testreplacedembly )
		{
			testRunner = new TestDomain();

			if ( !testRunner.Load( new TestPackage(testreplacedembly) ) )
			{
				this.wrong(cell);
				cell.addToBody( string.Format( 
					"<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testreplacedembly ) );

				return;
			}

			testResult = testRunner.Run(NullListener.NULL);
			testSummary = new ResultSummarizer( testResult );

			this.right( cell );
		}

19 Source : CompilationTests.cs
with MIT License
from roozbehid

[Test]
		public void LoadTestsFromCompiledreplacedembly()
		{
			CompilerResults results = compiler.CompileCode( goodCode );
			replacedert.AreEqual( 0, results.NativeCompilerReturnValue );

			TestRunner runner = new SimpleTestRunner();

			try
			{
				replacedert.IsTrue( runner.Load( new TestPackage( outputName ) ) );
				replacedert.AreEqual( 2, runner.Test.TestCount );
			}
			finally
			{
				runner.Unload();
			}
		}

19 Source : ConsoleUi.cs
with MIT License
from roozbehid

private static TestRunner MakeRunnerFromCommandLine( ConsoleOptions options )
		{
			TestPackage package;
			ConsoleOptions.DomainUsage domainUsage = ConsoleOptions.DomainUsage.Default;

			if (options.IsTestProject)
			{
				NUnitProject project = NUnitProject.LoadProject((string)options.Parameters[0]);
				string configName = options.config;
				if (configName != null)
					project.SetActiveConfig(configName);

				package = project.ActiveConfig.MakeTestPackage();
				package.TestName = options.fixture;

				domainUsage = ConsoleOptions.DomainUsage.Single;
			}
			else if (options.Parameters.Count == 1)
			{
				package = new TestPackage((string)options.Parameters[0]);
				domainUsage = ConsoleOptions.DomainUsage.Single;
			}
			else
			{
				package = new TestPackage("UNNAMED", options.Parameters);
				domainUsage = ConsoleOptions.DomainUsage.Multiple;
			}

			if (options.domain != ConsoleOptions.DomainUsage.Default)
				domainUsage = options.domain;
                    
			TestRunner testRunner = null;
				
			switch( domainUsage )
			{
				case ConsoleOptions.DomainUsage.None:
					testRunner = new NUnit.Core.RemoteTestRunner();
					// Make sure that addins are available
					CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
					break;

				case ConsoleOptions.DomainUsage.Single:
					testRunner = new TestDomain();
					break;

				case ConsoleOptions.DomainUsage.Multiple:
					testRunner = new MultipleTestDomainRunner();
					break;
			}

			package.TestName = options.fixture;
			package.Settings["ShadowCopyFiles"] = !options.noshadow;
			package.Settings["UseThreadedRunner"] = !options.nothread;
			testRunner.Load( package );

			return testRunner;
		}