public void Transient_instances_resolved_from_a_scope_are_disposed_when_the_scope_is_disposed() { var wasDisposed = false; var services = new ServiceCollection() .AddTransient(_ => Disposable.Create(() => { wasDisposed = true; })); var scope = new PocketContainer() .AsServiceProvider(services) .CreateScope(); scope.ServiceProvider.GetService <IDisposable>(); scope.Dispose(); wasDisposed.Should().BeTrue(); }