本文整理汇总了C#中TestRunner.RunTest方法的典型用法代码示例。如果您正苦于以下问题:C# TestRunner.RunTest方法的具体用法?C# TestRunner.RunTest怎么用?C# TestRunner.RunTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestRunner
的用法示例。
在下文中一共展示了TestRunner.RunTest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
try
{
TestRunner runner = new TestRunner();
Block.DataContext = runner;
IFileTester[] testers =
{
/*new FileExistsTester(),
new IsolatedStorageFileFileExistsTester(),
new StorageFolderGetFileAsyncTester(),
new StorageFileGetFileFromPathAsyncTester(),
new StorageFileGetFileFromApplicationUriAsyncTester(),
new StorageFolderGetFilesAsyncTester(),*/
new StorageFolderGetFileSyncTester(),
new StorageFileGetFileFromPathSyncTester(),
new StorageFileGetFileFromApplicationUriSyncTester(),
};
await runner.InitFiles(500, 0);
await runner.RunTest(testers);
await runner.InitFiles(500, 0.5);
await runner.RunTest(testers);
await runner.InitFiles(500, 1);
await runner.RunTest(testers);
}
catch (Exception exception)
{
Debug.WriteLine(exception);
}
}
示例2: ExecuteTest
public static MSVST4U_UnitTestResult ExecuteTest(IExecutorWrapper executor, Guid runId, MSVST4U_UnitTestElement testElement)
{
var logger = new XUnitTestRunner(runId, testElement);
var runner = new TestRunner(executor, logger);
string fclassname = MSVST4U_Access.GetFullyQualifiedClassName(testElement);
if (fclassname == null) throw new NotImplementedException("xUnit runner does not currently know how to extract a ClassName from test type: " + (testElement == null ? "(null)" : testElement.GetType().FullName));
// The testElement is the original UnitTestElement, so the result is the original UnitTestResult.
// However, due to the nature of some unit test types, we could have gathered many results, and must
// now group them together.
runner.RunTest(fclassname, testElement.Name);
MSVST4U_UnitTestResult result;
if (logger._isTheory)
{
Debug.Assert(logger._results.Count > 0, "Expected at least one result for Theory test " + testElement.Name + ": " + logger._results.Count);
MSVST4U_UnitTestResult[] innerResults = logger._results.ToArray();
TestOutcome outcome = TestOutcomeHelper.GetAggregationOutcome(innerResults);
// for a Theory test (a DataDriven test in the original VS nomenclature), the logger gathered
// multiple responses and they should be packed up together in a "TestAggregateResult". Actually,
// a original UnitTestResult already implements that and it is available as a constructor overload.
result = MSVST4U_Access.New_MSVST4U_UnitTestResult_DataDriven(runId, testElement, outcome, null, innerResults);
}
else
{
Debug.Assert(logger._results.Count == 1, "Expected one result for non-Theory test " + testElement.Name + ": " + logger._results.Count);
// for a Fact test (a NotDataDriven test in the original VS nomenclature), the logger gathered
// a single response; it is completely valid to simply return it
result = logger._results[0];
}
return result;
}
示例3: RunMethod
public static TestRunState RunMethod(TestRunner runner, MethodInfo method)
{
TestRunnerResult result = runner.RunTest(method.ReflectedType.FullName, method.Name);
return TestResultMapper.Map(result);
}