本文整理汇总了C#中Runner.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Runner.Load方法的具体用法?C# Runner.Load怎么用?C# Runner.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Runner
的用法示例。
在下文中一共展示了Runner.Load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeTestEngineResult
public void InitializeTestEngineResult()
{
// Save the local directory - used by GetLocalPath
Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
localDirectory = Path.GetDirectoryName(uri.LocalPath);
AssemblyPath = GetLocalPath(AssemblyName);
// Create a fresh copy of the engine, since we can't use the
// one that is running this test.
engine = TestEngineActivator.CreateInstance();
engine.InternalTraceLevel = InternalTraceLevel.Off;
// Create a new DefaultAssemblyRunner, which is actually a framework class,
// because we can't use the one that's currently running this test.
var runner = new Runner(new Builder());
var settings = new Dictionary<string, object>();
// Make sure the runner loaded the mock assembly.
Assert.That(
runner.Load(AssemblyPath, settings).RunState.ToString(),
Is.EqualTo("Runnable"),
"Unable to load mock-nunit-assembly.exe");
// Run the tests, saving the result as an XML string
var xmlText = runner.Run(TestListener.NULL, TestFilter.Empty).ToXml(true).OuterXml;
// Create a TestEngineResult from the string, just as the TestEngine does,
// then add a test-run element to the result, wrapping the result so it
// looks just like what the engine would return!
this.EngineResult = new TestEngineResult(xmlText).Aggregate("test-run", AssemblyName, AssemblyPath);
}