public void IsStatic_ReturnsFalse <TIn>(TIn inputParameter) { var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakAnonymousActionWithInstanceReference <TIn>()); Assert.False(weakAction.IsStatic); }
public void IsStatic_ReturnsFalse() { var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceAction()); Assert.False(weakAction.IsStatic); }
public void IsStatic_ReturnsFalse <TOut>(TOut outputParameter) { var(_, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceFunc <TOut>()); Assert.False(weakFunc.IsStatic); }
public void IsAlive_WithCustomTargetAlive_WithAfterGarbageCollection_ReturnsTrue() { var(_, weakAction) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticAction); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_WithCustomTargetAlive_AfterGarbageCollection_ReturnsTrue <TOut>(TOut outputParameter) { var(_, weakFunc) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>); GC.Collect(); Assert.True(weakFunc.IsAlive); }
public void IsAlive_WhenMarkedForDeletion_ReturnsFalse() { var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceAction()); weakAction.MarkForDeletion(); Assert.False(weakAction.IsAlive); }
public void IsAlive_WithCustomTargetAlive_WithOriginalTargetAlive_AfterGarbageCollection_ReturnsTrue() { var(_, _, weakAction) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(), (x, y) => x.GetWeakInstanceAction(y)); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_WithTargetReference_AfterGarbageCollection_ReturnsTrue <TIn>(TIn inputParameter) { var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakAnonymousActionWithInstanceReference <TIn>()); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_WithCustomTargetAlive_WithOriginalTargetAlive_AfterGarbageCollection_ReturnsTrue <TOut>(TOut outputParameter) { var(_, _, weakFunc) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(), (x, y) => x.GetWeakInstanceFunc <TOut>(y)); GC.Collect(); Assert.True(weakFunc.IsAlive); }
public void IsAlive_WithCustomTargetDead_AfterGarbageCollection_ReturnsFalse() { var(customTarget, weakAction) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticAction); customTarget.Dispose(); GC.Collect(); Assert.False(weakAction.IsAlive); }
public void IsAlive_WithTargetReference_AfterGarbageCollection_ReturnsTrue() { var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceAction()); GC.Collect(); Assert.True(weakAction.IsAlive); }
public void IsAlive_WithCustomTargetDead_AfterGarbageCollection_ReturnsFalse <TOut>(TOut outputParameter) { var(customTarget, weakFunc) = WeakDelegateCreator .CreateWeakDelegateWithCustomTarget(StaticWeakDelegatesCallCounter.GetWeakStaticFunc <TOut>); customTarget.Dispose(); GC.Collect(); Assert.False(weakFunc.IsAlive); }
public void IsAlive_WhenMarkedForDeletion_ReturnsFalse <TOut>(TOut outputParameter) { var(_, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceFunc <TOut>()); weakFunc.MarkForDeletion(); Assert.False(weakFunc.IsAlive); }
public void IsAlive_WithTargetReference_AfterGarbageCollection_ReturnsTrue <TOut>(TOut outputParameter) { var(_, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakInstanceFunc <TOut>()); GC.Collect(); Assert.True(weakFunc.IsAlive); }
public void IsAlive_WithoutTargetReference_AfterGarbageCollection_ReturnsFalse <TOut>(TOut outputParameter) { var(reference, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakAnonymousFuncWithInstanceReference <TOut>()); reference.Dispose(); GC.Collect(); Assert.False(weakFunc.IsAlive); }
public void IsAlive_WithoutTargetReference_AfterGarbageCollection_ReturnsFalse() { var(reference, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(), x => x.GetWeakAnonymousActionWithInstanceReference()); reference.Dispose(); GC.Collect(); Assert.False(weakAction.IsAlive); }
public void IsAlive_WithCustomTargetAlive_WithOriginalTargetDead_AfterGarbageCollection_ReturnsFalse <TIn>(TIn inputParameter) { var(_, originalTarget, weakAction) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(), (x, y) => x.GetWeakInstanceAction <TIn>(y)); originalTarget.Dispose(); GC.Collect(); Assert.False(weakAction.IsAlive); }
public void Execute_WithTargetReference_AfterGarbageCollection_InvokesFunc <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(_, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceFunc <TOut>()); weakFunc.Execute(); callCounter.Received(1).OnFuncCalled <TOut>(); }
public void IsAlive_WithCustomTargetDead_WithOriginalTargetDead_AfterGarbageCollection_ReturnsFalse <TOut>(TOut outputParameter) { var(customTarget, originalTarget, weakFunc) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(), (x, y) => x.GetWeakInstanceFunc <TOut>(y)); customTarget.Dispose(); originalTarget.Dispose(); GC.Collect(); Assert.False(weakFunc.IsAlive); }
public void Execute_WithTargetReference_AfterGarbageCollection_InvokesAction <TIn>(TIn inputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakAnonymousActionWithInstanceReference <TIn>()); weakAction.Execute(inputParameter); callCounter.Received(1).OnActionCalled(inputParameter); }
public void Execute_WithTargetReference_AfterGarbageCollection_InvokesAction() { var callCounter = Substitute.For <ICallCounter>(); var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceAction()); weakAction.Execute(); callCounter.Received(1).OnActionCalled(); }
public void Execute_WhenMarkedForDeletion_DoesNotInvokeAction() { var callCounter = Substitute.For <ICallCounter>(); var(_, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceAction()); weakAction.MarkForDeletion(); weakAction.Execute(); callCounter.DidNotReceive().OnActionCalled(); }
public void Execute_WithCustomTargetAlive_WithOriginalTargetAlive_AfterGarbageCollection_InvokesAction() { var callCounter = Substitute.For <ICallCounter>(); var(_, _, weakAction) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(callCounter), (x, y) => x.GetWeakInstanceAction(y)); GC.Collect(); weakAction.Execute(); callCounter.Received(1).OnActionCalled(); }
public void Execute_WithCustomTargetAlive_WithOriginalTargetAlive_AfterGarbageCollection_InvokesFunc <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(_, _, weakFunc) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(callCounter), (x, y) => x.GetWeakInstanceFunc <TOut>(y)); GC.Collect(); weakFunc.Execute(); callCounter.Received(1).OnFuncCalled <TOut>(); }
public void Execute_WhenMarkedForDeletion_DoesNotInvokeAction <TIn, TOut>( TIn inputParameter, TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(_, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceFunc <TIn, TOut>()); weakFunc.MarkForDeletion(); weakFunc.Execute(inputParameter); callCounter.DidNotReceive().OnActionCalled(); }
public void Execute_WithoutTargetReference_AfterGarbageCollection_DoesNotInvokeAction <TIn>(TIn inputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(reference, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakAnonymousActionWithInstanceReference <TIn>()); reference.Dispose(); GC.Collect(); weakAction.Execute(inputParameter); callCounter.DidNotReceive().OnActionCalled(Arg.Any <TIn>()); }
public void Execute_WithoutTargetReference_AfterGarbageCollection_DoesNotInvokeAction() { var callCounter = Substitute.For <ICallCounter>(); var(reference, weakAction) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceAction()); reference.Dispose(); GC.Collect(); weakAction.Execute(); callCounter.DidNotReceive().OnActionCalled(); }
public void Execute_WithCustomTargetDead_WithOriginalTargetAlive_AfterGarbageCollection_DoesNotInvokeAction <TIn>(TIn inputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(customTarget, _, weakAction) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(callCounter), (x, y) => x.GetWeakInstanceAction <TIn>(y)); customTarget.Dispose(); GC.Collect(); weakAction.Execute(inputParameter); callCounter.DidNotReceive().OnActionCalled(Arg.Any <TIn>()); }
public void Execute_WithoutTargetReference_AfterGarbageCollection_DoesNotInvokeFunc <TOut>(TOut outputParameter) { var callCounter = Substitute.For <ICallCounter>(); var(reference, weakFunc) = WeakDelegateCreator.CreateWeakDelegate( () => new WeakDelegatesCallCounter(callCounter), x => x.GetWeakInstanceFunc <TOut>()); reference.Dispose(); GC.Collect(); weakFunc.Execute(); callCounter.DidNotReceive().OnFuncCalled <TOut>(); }
public void Execute_WithCustomTargetAlive_WithOriginalTargetDead_AfterGarbageCollection_DoesNotInvokeAction() { var callCounter = Substitute.For <ICallCounter>(); var(_, originalTarget, weakAction) = WeakDelegateCreator.CreateWeakDelegateWithCustomTarget( () => new WeakDelegatesCallCounter(), (x, y) => x.GetWeakInstanceAction(y)); originalTarget.Dispose(); GC.Collect(); weakAction.Execute(); callCounter.DidNotReceive().OnActionCalled(); }