public void DisposeScopeOnAppDisposingDoesNothingWhenNoTokenPresent()
        {
            var app = new AppBuilder();
            var scope = new TestableLifetimeScope();

            // XUnit doesn't have Assert.DoesNotThrow
            app.DisposeScopeOnAppDisposing(scope);
        }
        public void DisposeScopeOnAppDisposing()
        {
            var app = new AppBuilder();
            var tcs = new CancellationTokenSource();
            var scope = new TestableLifetimeScope();
            app.Properties.Add("host.OnAppDisposing", tcs.Token);

            app.DisposeScopeOnAppDisposing(scope);

            tcs.Cancel();

            Assert.True(scope.ScopeIsDisposed);
        }
 public void DisposeScopeOnAppDisposingLifetimeScopeRequired()
 {
     var app = new AppBuilder();
     Assert.Throws<ArgumentNullException>(() => app.DisposeScopeOnAppDisposing(null));
 }