public void LifetimeScopeDispose_WithTransientRegisteredForDisposal_DisposesThatInstance() { // Arrange DisposableCommand transientInstanceToDispose = null; var container = new Container(); container.Options.EnableAutoVerification = false; container.Register <DisposableCommand>(); var lifestyle = new ThreadScopedLifestyle(); container.RegisterInitializer <DisposableCommand>(command => { lifestyle.RegisterForDisposal(container, command); }); using (ThreadScopedLifestyle.BeginScope(container)) { transientInstanceToDispose = container.GetInstance <DisposableCommand>(); // Act } // Assert Assert.IsTrue(transientInstanceToDispose.HasBeenDisposed); }