当前位置: 首页>>代码示例>>C#>>正文


C# Runner.Load方法代码示例

本文整理汇总了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);
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:32,代码来源:XmlOutputTest.cs


注:本文中的Runner.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。