public static async Task RunTestsInClass(this Type classToTest, Action <XunitTestRunner.Test> onTestStarted, Func <XunitTestRunner.Test, bool> testBlacklistFilter = null)
 {
     using (var t = Log.MethodEnteredWith("classToTest: " + classToTest)) {
         IEnumerable <XunitTestRunner.Test> collectedTests = XunitTestRunner.GetIteratorOverAllTests(classToTest, onTestStarted);
         if (testBlacklistFilter != null)
         {
             collectedTests = collectedTests.Filter(testBlacklistFilter);
         }
         await collectedTests.RunTests();
     }
 }
Ejemplo n.º 2
0
        private void CollectTests(IEnumerable <Assembly> assembliesToTest, Dictionary <string, Link> links)
        {
            var allClasses = assembliesToTest.ReduceToUnion(assembly => {
                if (assembly == null)
                {
                    return(new Type[0]);
                }                                             // return emtpy list
                return(assembly.GetExportedTypes());
            });
            var allTests = XunitTestRunner.CollectAllTests(allClasses, (test) => {
                // callback before a test is executed
            });

            AssertV2.AreNotEqual(0, allTests.Count);
            StartCoroutine(ShowAllFoundTests(allTests));
            if (autoRunAllTests)
            {
                links.Get <Text>("ButtonText").text = "Now running " + allTests.Count + " tests..";
            }
            else
            {
                links.Get <Text>("ButtonText").text = "Found " + allTests.Count + " tests (click one to run it)";
            }
        }