public void IsStatic_ReturnsTrue <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var weakFunc = StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TIn, TOut>(); Assert.True(weakFunc.IsStatic); }
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 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>(); } }