public void LifetimeScope_Owns_FuncResult() { var factory = LifetimeScope.ResolveRequiredService <IOwned <Func <IDisposableInterface> > >(); IDisposableInterface instance = factory.Value(); Assert.False(instance.IsDisposed); LifetimeScope.Dispose(); Assert.False(instance.IsDisposed); }
public void LifetimeScope_DoesNotOwn_FuncResult() { Func <IDisposableInterface> factory = LifetimeScope.ResolveRequiredService <Func <IDisposableInterface> >(); IDisposableInterface instance = factory(); Assert.False(instance.IsDisposed); LifetimeScope.Dispose(); Assert.True(instance.IsDisposed); }