Example #1
0
        public void AddAfterDisposed()
        {
            var counter = new ScopeCounter(Mock.Of <ILifetimeScope>());

            counter.Release();
            counter.Add();
        }
Example #2
0
        public void AddAndRelease()
        {
            var scope = new Mock <ILifetimeScope>(MockBehavior.Strict);

            scope.Setup(_ => _.Dispose());

            var counter = new ScopeCounter(scope.Object);

            counter.Add();
            counter.Add();
            counter.Release();
            counter.Release();
            counter.Release();

            Assert.IsNull(counter.Scope);
            scope.VerifyAll();
        }