Beispiel #1
0
        public void IsStatic_ReturnsFalse()
        {
            var callCounter = Substitute.For <ICallCounter>();
            var weakAction  = WeakDelegatesCallCounter.GetWeakAnonymousActionWithLocalReference(callCounter);

            Assert.False(weakAction.IsStatic);
        }
Beispiel #2
0
        public void IsAlive_AfterGarbageCollection_ReturnsFalse()
        {
            var callCounter = Substitute.For <ICallCounter>();
            var weakAction  = WeakDelegatesCallCounter.GetWeakAnonymousActionWithLocalReference(callCounter);

            GC.Collect();

            Assert.False(weakAction.IsAlive);
        }
Beispiel #3
0
        public void Execute_AfterGarbageCollection_DoesNotInvokeAction()
        {
            var callCounter = Substitute.For <ICallCounter>();
            var weakAction  = WeakDelegatesCallCounter.GetWeakAnonymousActionWithLocalReference(callCounter);

            GC.Collect();

            weakAction.Execute();

            callCounter.DidNotReceive().OnActionCalled();
        }