コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }