Beispiel #1
0
        public async void StartAssemblyScan()
        {
            IsBusy = true;
            try
            {
                var allTests = await runner.Discover();

                // Back on UI thread
                foreach (var vm in allTests)
                {
                    TestAssemblies.Add(vm);
                }

                var evt = ScanComplete;
                evt?.Invoke(this, EventArgs.Empty);

                mre.Set();
            }
            finally
            {
                IsBusy = false;
            }

            if (RunnerOptions.Current.AutoStart)
            {
                await Task.Run(() => mre.Wait());
                await Run();

                if (RunnerOptions.Current.TerminateAfterExecution)
                {
                    PlatformHelpers.TerminateWithSuccess();
                }
            }
        }
Beispiel #2
0
        static Stream GetConfigurationStreamForAssembly(string assemblyName)
        {
#if __ANDROID__
            // Android needs to read the config from its asset manager
            return(PlatformHelpers.ReadConfigJson(assemblyName));
#else
            // See if there's a directory with the assm name. this might be the case for appx
            if (Directory.Exists(assemblyName))
            {
                if (File.Exists(Path.Combine(assemblyName, $"{assemblyName}.xunit.runner.json")))
                {
                    return(File.OpenRead(Path.Combine(assemblyName, $"{assemblyName}.xunit.runner.json")));
                }

                if (File.Exists(Path.Combine(assemblyName, "xunit.runner.json")))
                {
                    return(File.OpenRead(Path.Combine(assemblyName, "xunit.runner.json")));
                }
            }

            // Fallback to working dir

            // look for a file called assemblyName.xunit.runner.json first
            if (File.Exists($"{assemblyName}.xunit.runner.json"))
            {
                return(File.OpenRead($"{assemblyName}.xunit.runner.json"));
            }

            if (File.Exists("xunit.runner.json"))
            {
                return(File.OpenRead("xunit.runner.json"));
            }

            return(null);
#endif
        }