Exemple #1
0
    public static async Task <int> Main(string[] args)
    {
        s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList();
        if (s_testLibs.Count < 1)
        {
            Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})");
            return(-1);
        }
        int exitCode = 0;

        s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]);
        var simpleTestRunner = new SimpleAndroidTestRunner(true);

        simpleTestRunner.TestsCompleted += (e, result) =>
        {
            if (result.FailedTests > 0)
            {
                exitCode = 1;
            }
        };

        await simpleTestRunner.RunAsync();

        Console.WriteLine("----- Done -----");
        return(exitCode);
    }
    public static async Task <int> Main(string[] args)
    {
        s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList();
        if (s_testLibs.Count < 1)
        {
            Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})");
            return(-1);
        }
        int exitCode = 0;

        s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]);
        string?verbose          = Environment.GetEnvironmentVariable("XUNIT_VERBOSE")?.ToLower();
        bool   enableMaxThreads = (Environment.GetEnvironmentVariable("XUNIT_SINGLE_THREADED") != "1");
        var    simpleTestRunner = new SimpleAndroidTestRunner(verbose == "true" || verbose == "1", enableMaxThreads);

        simpleTestRunner.TestsCompleted += (e, result) =>
        {
            if (result.FailedTests > 0)
            {
                exitCode = 1;
            }
        };

        await simpleTestRunner.RunAsync();

        Console.WriteLine("----- Done -----");
        return(exitCode);
    }