本文整理汇总了C#中Runner.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Runner.Run方法的具体用法?C# Runner.Run怎么用?C# Runner.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Runner
的用法示例。
在下文中一共展示了Runner.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
//var runner = new Runner(); //default settings
var runner = new Runner(new CustomSettings()); //or override for custom settings
runner.Run();
}
示例2: Main
public static int Main(string[] args)
{
var consoleWriter = new ConsoleWriter();
try
{
var settings = new SaucySettings();
ILogger logger = new VerboseLogger();
var restoreVerb = new SaucyCommandLine(
new PackagesRestorer(
new JsonLoader(),
new ProviderMatcher(new GitHubProvider(new FolderSync(logger))),
consoleWriter,
settings),
settings);
var runner = new Runner();
runner.Register(restoreVerb);
var exitCode = runner.Run(args);
return exitCode;
}
catch (Exception e)
{
consoleWriter.Write(e.Message);
consoleWriter.Write(e.StackTrace);
return -1;
}
}
示例3: InitializeTestEngineResult
public void InitializeTestEngineResult()
{
// Save the local directory - used by GetLocalPath
Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
localDirectory = Path.GetDirectoryName(uri.LocalPath);
// 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 assemblyPath = GetLocalPath("mock-nunit-assembly.dll");
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-assembly.dll");
// 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", "NAME", "FULLNAME");
}
示例4: Should_run_all_tests
public void Should_run_all_tests()
{
var settings = new RunSettings(new AssemblyOptions(Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll")), new string[] {}, null);
var runner = new Runner();
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(10));
}
示例5: Main
private static void Main() {
Runner<ExecutionContext> runner = new Runner<ExecutionContext>(new ExecutionContext(Console.In, new ConsoleTextWriter(new SqlStyleProvider())));
try {
runner.Run();
} finally {
Console.ResetColor();
}
}
示例6: When_told_to_run_all_tests_it_reports_all_tests
public void When_told_to_run_all_tests_it_reports_all_tests()
{
var runner = new Runner();
var options = new AssemblyOptions(getAssembly());
var settings = new RunSettings(options, new string[] { }, null);
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(5));
}
示例7: Main
static void Main()
{
ServiceManager.Initialize("MyService", "My Service", "This is my special service that doesn't do much of anything!");
var config = new ConfigurationOptions("--");
var runner = new Runner(new Service(), config);
runner.Run();
}
示例8: when_told_to_run_all_on_type_it_runs_all_on_type
public void when_told_to_run_all_on_type_it_runs_all_on_type()
{
var runner = new Runner();
var options = new AssemblyOptions(getAssembly());
options.AddMember("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests");
var settings = new RunSettings(options, new string[] { }, null);
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(3));
}
示例9: MultipleAppDomainsAndCurrent
public void MultipleAppDomainsAndCurrent()
{
using (var runner = new Runner())
{
runner.Run();
RunThreads();
}
}
示例10: Should_Exit_When_Exit_Command_Issued
public void Should_Exit_When_Exit_Command_Issued()
{
_console.Setup(c => c.ReadLine()).Returns("x");
var runner = new Runner(_console.Object, _environment.Object);
runner.Run();
_environment.Verify(e => e.Exit(0), Times.Once());
}
示例11: Should_not_run_test_with_ignore_attribute
public void Should_not_run_test_with_ignore_attribute()
{
var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
var assembly = new AssemblyOptions(assemblyPath);
assembly.AddTest("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture1.Ignore_Attrib_test");
var settings = new RunSettings(assembly, new string[] { }, null);
var runner = new Runner();
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(0));
}
示例12: HandleServerException
public void HandleServerException()
{
RemotingMock cc = new RemotingMock(typeof(ICruiseManager));
cc.ExpectAndThrow("Run", new Exception("server exception"), new IsAnything(), new IsAnything());
TcpChannel channel = new TcpChannel(2334);
using (MockServer server = new MockServer(cc.MarshalByRefInstance, channel, "MockCruise.rem"))
{
Runner runner = new Runner();
runner.Url = "tcp://localhost:2334/MockCruise.rem";
runner.Run("myProject");
}
}
示例13: Should_run_full_fixture
public void Should_run_full_fixture()
{
var assemblyPath = Path.GetFullPath(@"AutoTest.TestRunners.MSTest.Tests.TestResource.dll");
var assembly = new AssemblyOptions(assemblyPath);
assembly.AddMember("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2");
var settings = new RunSettings(assembly, new string[] { });
var runner = new Runner();
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(2));
var test = result.ElementAt(0);
Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2"));
Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2.Another_passing_test"));
Assert.That(result.ElementAt(1).TestFixture, Is.EqualTo("AutoTest.TestRunners.MSTest.Tests.TestResource.TestFixture2"));
}
示例14: When_told_to_run_a_test_that_is_ignored_it_reports_a_ignored_result
public void When_told_to_run_a_test_that_is_ignored_it_reports_a_ignored_result()
{
var runner = new Runner();
var options = new AssemblyOptions(getAssembly());
options.AddTest("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test");
var settings = new RunSettings(options, new string[] { }, null);
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(1));
var test = result.ElementAt(0);
Assert.That(test.State, Is.EqualTo(Shared.Results.TestState.Ignored));
Assert.That(test.Assembly, Is.EqualTo(getAssembly()));
Assert.That(test.Runner, Is.EqualTo("MSpec"));
Assert.That(test.TestFixture, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test"));
Assert.That(test.TestName, Is.EqualTo("AutoTest.TestRunners.MSpec.Tests.TestResource.Ignored_test"));
}
示例15: when_running_named_test_that_passes
public void when_running_named_test_that_passes()
{
var runner = new Runner();
var options = new AssemblyOptions(getAssembly());
options.AddTest("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests.a_passing_test");
var settings = new RunSettings(options, new string[] { }, null);
var result = runner.Run(settings);
Assert.That(result.Count(), Is.EqualTo(1));
Assert.That(result.First().State == TestState.Passed);
Assert.That(!result.First().StackLines.Any());
Assert.That(result.First().TestDisplayName == "a_passing_test");
Assert.That(result.First().Runner == "SimpleTesting");
Assert.AreEqual("AutoTest.TestRunners.SimpleTesting.Tests.Resources.SimpleTestingTests.a_passing_test", result.First().TestName);
Assert.AreEqual("SimpleTestingTests", result.First().TestFixture);
}