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


C# TestRunner.Run方法代码示例

本文整理汇总了C#中TestRunner.Run方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunner.Run方法的具体用法?C# TestRunner.Run怎么用?C# TestRunner.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestRunner的用法示例。


在下文中一共展示了TestRunner.Run方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static int Main(string[] args)
    {
        // parse the command line
        CommandLineArguments cmdLine = CommandLineParser.Parse(new string[] {}, args);
        if(cmdLine.GetArguments().Length != 1)
        {
            Usage();
            return FAIL_CODE;
        }

        string testFile = cmdLine.GetArguments()[0];

        // parse the test file
        TestGroup[] groups = null;
        try
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(testFile);

            // Load up the algorithm tables
            Hashtable algorithms = ParseAlgorithms((XmlElement)doc.GetElementsByTagName("HashFunctions")[0]);

            // Load the test cases
            groups = ParseTestCases((XmlElement)doc.GetElementsByTagName("Tests")[0], algorithms);
        }
        catch(Exception e)
        {
            Console.Error.WriteLine("Error parsing input file : " + e.Message);
            return FAIL_CODE;
        }

        // setup the tests
        TestRunner runner = new TestRunner(groups, new ILogger[] { new ConsoleLogger(), new XmlLogger()});
        return runner.Run("HashDriver") ? PASS_CODE : FAIL_CODE;
    }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:35,代码来源:HashDriver.cs

示例2: testCanRunTestAndReportResults

        public void testCanRunTestAndReportResults()
        {
            TestRunner runner = new TestRunner();
            runner.AddListener(this);
            runner.Run(new DummyTestSuite("SNSFSES"));

            Assert.That(tests, Is.EqualTo(7), "tests");
            Assert.That(errors, Is.EqualTo(1), "errors");
            Assert.That(failures, Is.EqualTo(1), "failures");
            Assert.That(notrun, Is.EqualTo(0), "notrun");
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:11,代码来源:TestRunnerTests.cs

示例3: Main

        private static void Main()
        {
            var runner = new TestRunner();
            runner.TestsAssembly = Assembly.GetExecutingAssembly();
            runner.Run();

            Application.SetCompatibleTextRenderingDefault(false);
                 printDemoMemberInfo();

                 MyConsole aConsole = new MyConsole();
            aConsole.run();
        }
开发者ID:JasperH,项目名称:CSConsole,代码行数:12,代码来源:Program.cs

示例4: Main

        public static void Main(string[] args)
        {
            var options = new Options();
            if(!Parser.Default.ParseArguments(args, options))
            {
                Console.Error.WriteLine("Unsupported options provided.");
                return;
            }
            if(options.Id == null)
            {
                options.Id = typeof(Serializer).Assembly.GetName().Version.ToString();
            }

            Console.WriteLine("==========================");
            Console.WriteLine("Migrant performance tester");
            Console.WriteLine("==========================");
            Console.WriteLine("");

            foreach(SerializerType serializerType in Enum.GetValues(typeof(SerializerType)))
            {
                Console.WriteLine("----------------");
                Console.WriteLine("Serializer type: {0}", serializerType);
                Console.WriteLine("----------------");
                Console.WriteLine("");

                foreach(TestType testType in Enum.GetValues(typeof(TestType)))
                {
                    Console.WriteLine("++++++++++");
                    Console.WriteLine("Test type: {0}", testType);
                    Console.WriteLine("++++++++++");
                    Console.WriteLine("");

                    foreach(var test in new ITest<object>[] { new SimpleStructTest(), new SimpleClassTest() })
                    {
                        var runner = new TestRunner(testType, serializerType);
                        var result = runner.Run((dynamic)test);
                        Console.WriteLine("{0,20}: {1}", test.GetType().Name, result);
                        if(options.OutputFile != null)
                        {
                            File.AppendAllText(options.OutputFile, string.Format("{0}-{1}-{2}-{3};{4};{5}{6}", serializerType, test.GetType().Name, testType, options.Id, result.Average, result.StandardDeviation, Environment.NewLine));
                        }
                    }
                    Console.WriteLine("");
                }
            } 
        }
开发者ID:StepWoodProductions,项目名称:Migrant,代码行数:46,代码来源:Program.cs

示例5: run

 private TestResult run(TestRunner testRunner, TestHarvester harvester, TestFilter testFilter, string savedDirectory)
 {
     TestResult result = null;
     try
     {
         result = testRunner.Run(harvester, testFilter, false, LoggingThreshold.Off);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     finally
     {
         Environment.CurrentDirectory = savedDirectory;
     }
     return result;
 }
开发者ID:zippy1981,项目名称:AutoTest.Net,代码行数:17,代码来源:NUnitRunner.cs

示例6: LoadAndRunTestAssembly

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

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

				return;
			}

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

			this.right( cell );
		}
开发者ID:nobled,项目名称:mono,代码行数:18,代码来源:TestLoadFixture.cs

示例7: Main

    public static int Main(String[] args) 
    {
		Exception[] cryptoEx = new Exception[] { new CryptographicException() };

		TestGroup apiTests = new TestGroup("API tests", new TestCase[]
		{
			new TestCase("GetBytes with small values", new TestCaseImpl(GetBytesSmall)),
			new TestCase("Reset and ensure same", new TestCaseImpl(Reset)),
			new TestCase("Set and Check Hash", new TestCaseImpl(SetCheckHash)),
			new TestCase("Set and Check Salt", new TestCaseImpl(SetCheckSalt)),
			new TestCase("Set and Check IC", new TestCaseImpl(SetCheckIC)),
			new TestCase("Create with password bytes", new TestCaseImpl(CreateWithPasswordBytes)),
			new TestCase("Create with password bytes and CSP", new TestCaseImpl(CreateWithPasswordBytesCSP))
		});

		TestGroup exceptionTests = new TestGroup("Exception tests", new TestCase[]
		{
			new ExceptionTestCase("Derive key, negative key size", new ExceptionTestCaseImpl(DeriveNegKey), cryptoEx),
			new ExceptionTestCase("Derive key, bad algorithm", new ExceptionTestCaseImpl(DeriveKeyBadAlg), cryptoEx),
			new ExceptionTestCase("Derive key, null IV", new ExceptionTestCaseImpl(DeriveKeyNullIv), cryptoEx),
			new ExceptionTestCase("Null HashName", new ExceptionTestCaseImpl(NullHashName), ExceptionTestCase.ArgumentExceptions),
			new ExceptionTestCase("Set HashName after Calculating", new ExceptionTestCaseImpl(HashNameAfterCalc), cryptoEx),
			new ExceptionTestCase("Set Salt after Calculating", new ExceptionTestCaseImpl(SaltAfterCalc), cryptoEx),
			new ExceptionTestCase("Zero iteration count", new ExceptionTestCaseImpl(ZeroIC), ExceptionTestCase.ArgumentExceptions),
			new ExceptionTestCase("Negative iteration count", new ExceptionTestCaseImpl(NegativeIC), ExceptionTestCase.ArgumentExceptions),
			new ExceptionTestCase("Set iteration count after calcuating", new ExceptionTestCaseImpl(ICAfterCalc), cryptoEx)
		});

		TestGroup customTests = new TestGroup("Custom Impl tests", new TestCase[]
		{
			new TestCase("Compare with custom impl", new TestCaseImpl(CompareWithCustom))
		});

		TestGroup otherTests = new TestGroup("Other tests", new TestCase[]
		{
			new TestCase("Change hash", new TestCaseImpl(ChangeHash)),
			new TestCase("Change salt", new TestCaseImpl(ChangeSalt))
		});

		TestRunner runner = new TestRunner(new TestGroup[] { apiTests, exceptionTests, customTests, otherTests }, new ILogger[] { new ConsoleLogger(), new XmlFailureLogger() });
        return runner.Run() ? PASS_CODE : FAIL_CODE;
    }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:42,代码来源:PwdDrvBytes.cs

示例8: RunPartition

        private TestResult RunPartition(bool redirectOutput, bool redirectError, TestRunner testRunner, TextWriter outWriter, TextWriter errorWriter, TestFilter testFilter, EventListener collector)
        {
            TestResult result = null;
            var savedDirectory = Environment.CurrentDirectory;
            var savedOut = System.Console.Out;
            var savedError = System.Console.Error;

            try
            {
                result = testRunner.Run(collector, testFilter);
            }
            finally
            {
                outWriter.Flush();
                errorWriter.Flush();

                if (redirectOutput)
                    outWriter.Close();
                if (redirectError)
                    errorWriter.Close();

                Environment.CurrentDirectory = savedDirectory;
                System.Console.SetOut(savedOut);
                System.Console.SetError(savedError);
            }

            System.Console.WriteLine();
            return result;
        }
开发者ID:kurman,项目名称:mt-nunit-console,代码行数:29,代码来源:ConsoleUi.cs

示例9: RunTesterBlocking

        public TestResult RunTesterBlocking()
        {
            using (_testRunner = GetTestRunner())
            {
                //MarkAsRunning();
                var results = _testRunner.Run(this, Filter, false, LoggingThreshold.Off);
                //MarkAsFinished();

                //TESTING:
                if (!FinishedRunning) throw new Exception("NEED TO CALL MarkAsFinished!!!");

                return results;
            }
        }
开发者ID:uShip,项目名称:Concord,代码行数:14,代码来源:InternalCategoryRunner.cs

示例10: Run

 public static TestResult Run(TestRunner runner, EventCollector listener, ITestFilter filter)
 {
     return runner.Run(listener, filter);
 }
开发者ID:Xarlot,项目名称:reportformatter,代码行数:4,代码来源:NUnutHelper.cs

示例11: RunTests

 protected virtual TestResult[] RunTests(EventListener listener, TestRunner runner, Test test)
 {
     return new TestResult[] { runner.Run(listener) };
 }
开发者ID:ravikp,项目名称:nant,代码行数:4,代码来源:NUnit2Task.cs

示例12: Main

 static void Main(string[] args)
 {
     var runner = new TestRunner();
     runner.Run();
     Console.ReadLine();
 }
开发者ID:Vidarls,项目名称:TestingFrameworkThingy,代码行数:6,代码来源:Program.cs


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