public void DelegationBehaviors()
        {
            var innerFactory      = new CustomizedFactory(this.context, this.AddToLog);
            var delegatingFactory = new DelegatingFactory(innerFactory, this.AddToLog);

            delegatingFactory.Run(async delegate
            {
                await Task.Delay(1);
            });

            var jt = delegatingFactory.RunAsync(async delegate
            {
                await TaskScheduler.Default;
                await delegatingFactory.SwitchToMainThreadAsync();
            });

            jt.Join();

            lock (this.logLock)
            {
                while (!ValidateDelegatingLog(this.log.ToList()))
                {
                    this.Logger.WriteLine("Waiting with a count of {0}", this.log.Count);
                    Assert.True(Monitor.Wait(this.logLock, AsyncDelay));
                }
            }
        }
        public void DelegationSharesCollection()
        {
            var          log = new List <FactoryLogEntry>();
            var          delegatingFactory = new DelegatingFactory(this.asyncPump, this.AddToLog);
            JoinableTask?jt = null;

            jt = delegatingFactory.RunAsync(async delegate
            {
                await Task.Yield();
                Assert.True(this.joinableCollection !.Contains(jt !));
            });