コード例 #1
0
ファイル: Program.cs プロジェクト: JeroenBos/BlaTeX
        public static async Task Main(string[] args)
        {
            if (args.Contains("--async"))
            {
                var syncContext = new XunitAsyncTestSyncContext(null); // new Nito.AsyncEx.AsyncContext().SynchronizationContext
                using (syncContext.AsTemporarySynchronizationContext())
                {
                    TestExtensions.DefaultMainTestProjectImplementation(args);
                }
                var exception = await syncContext.WaitForCompletionAsync();

                var _ = exception switch
                {
                    AggregateException a when a.InnerExceptions.Count == 1 => throw a.InnerExceptions[0],
                          Exception e => throw e,
                    null => (object)null,
                };
            }
            else
            {
                TestExtensions.DefaultMainTestProjectImplementation(args);
            }
        }