public void IsStatic_ReturnsFalse() { var weakAction = StaticWeakDelegatesCallCounter .GetWeakAnonymousActionWithStaticReference(); Assert.False(weakAction.IsStatic); }
public void IsStatic_ReturnsTrue <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TIn, TOut>(); Assert.True(weakFunc.IsStatic); }
public void IsStatic_ReturnsFalse <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TIn, TOut>(); Assert.False(weakFunc.IsStatic); }
public void IsAlive_WhenMarkedForDeletion_ReturnsFalse <TIn>(TIn inputParameter) { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction <TIn>(); weakAction.MarkForDeletion(); Assert.False(weakAction.IsAlive); }
public void IsAlive_AfterGarbageCollection_ReturnsTrue <TIn>(TIn inputParameter) { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction <TIn>(); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_WhenMarkedForDeletion_ReturnsFalse <TOut>(TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>(); weakFunc.MarkForDeletion(); Assert.False(weakFunc.IsAlive); }
public void IsAlive_AfterGarbageCollection_ReturnsTrue <TOut>(TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>(); GC.Collect(); Assert.True(weakFunc.IsAlive); }
public void IsAlive_AfterGarbageCollection_ReturnsTrue() { var weakAction = StaticWeakDelegatesCallCounter .GetWeakAnonymousActionWithStaticReference(); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_AfterGarbageCollection_ReturnsTrue <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TIn, TOut>(); GC.Collect(); Assert.True(weakFunc.IsAlive); }
public void Execute_AfterGarbageCollection_InvokesAction <TIn>(TIn inputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction <TIn>(); GC.Collect(); weakAction.Execute(inputParameter); callCounter.Received(1).OnActionCalled(inputParameter); } }
public void Execute_WhenMarkedForDeletion_DoesNotInvokeAction <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>(); weakFunc.MarkForDeletion(); weakFunc.Execute(); callCounter.DidNotReceive().OnActionCalled(); } }
public void Execute_AfterGarbageCollection_InvokesFunc <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>(); GC.Collect(); weakFunc.Execute(); callCounter.Received(1).OnFuncCalled <TOut>(); } }
public void Execute_WhenMarkedForDeletion_DoesNotInvokeAction <TIn>(TIn inputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction <TIn>(); weakAction.MarkForDeletion(); weakAction.Execute(inputParameter); callCounter.DidNotReceive().OnActionCalled(Arg.Any <TIn>()); } }
public void Execute_AfterGarbageCollection_InvokesFunc <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TIn, TOut>(); weakFunc.Execute(inputParameter); callCounter.Received(1).OnFuncCalled <TIn, TOut>(inputParameter); } }
public void Execute_AfterGarbageCollection_InvokesAction() { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var weakAction = StaticWeakDelegatesCallCounter .GetWeakAnonymousActionWithStaticReference(); GC.Collect(); weakAction.Execute(); callCounter.Received(1).OnActionCalled(); } }
public void Execute_WithCustomTargetAlive_WithAfterGarbageCollection_InvokesAction() { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var(_, weakAction) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticAction); GC.Collect(); weakAction.Execute(); callCounter.Received(1).OnActionCalled(); } }
public void Execute_WithCustomTargetDead_AfterGarbageCollection_DoesNotInvokeFunc <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var(customTarget, weakFunc) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>); customTarget.Dispose(); GC.Collect(); weakFunc.Execute(); callCounter.DidNotReceive().OnFuncCalled <TOut>(); } }
public void Execute_WithCustomTargetDead_AfterGarbageCollection_DoesNotInvokeAction() { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var(customTarget, weakAction) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticAction); customTarget.Dispose(); GC.Collect(); weakAction.Execute(); callCounter.DidNotReceive().OnActionCalled(); } }
public void Execute_WithCustomTargetAlive_AfterGarbageCollection_InvokesFunc <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter)) { var(_, weakFunc) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TIn, TOut>); GC.Collect(); weakFunc.Execute(inputParameter); callCounter.Received(1).OnFuncCalled <TIn, TOut>(inputParameter); } }
public void IsStatic_ReturnsTrue() { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction(); Assert.True(weakAction.IsStatic); }
public void IsStatic_ReturnsTrue <TIn>(TIn inputParameter) { var weakAction = StaticWeakDelegatesCallCounter.GetWeakStaticAction <TIn>(); Assert.True(weakAction.IsStatic); }