private System.WeakReference <T> Create <T>(LifeTimeCounter counter, Func <LifeTimeCounter, T> factory) where T : class, IDisposable { using (var sut = factory(counter)) { return(new System.WeakReference <T>(sut)); } }
private LifeTimeCounter Lifecycle <T>(Func <LifeTimeCounter, T> factory) where T : class, IDisposable { var counter = new LifeTimeCounter(); var sut = Create(counter, factory); GC.Collect(3, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); GC.Collect(3, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); Assert.IsFalse(sut.TryGetTarget(out var _)); return(counter); }
public When_InheritFromAnotherLifecycleObject_Then_AllMethodInvoked_Subject(LifeTimeCounter counter) : base(counter) { Initialize(); }
public When_InheritFromAnotherLifecycleObject_Then_AllMethodInvoked_Base(LifeTimeCounter counter) { _counter = counter; Initialize(); }
private System.WeakReference <When_SimulateLifetimeOfObject_Then_AllMethodInvoked_Subject> Create(LifeTimeCounter counter) { using (var sut = new When_SimulateLifetimeOfObject_Then_AllMethodInvoked_Subject(counter)) { return(new System.WeakReference <When_SimulateLifetimeOfObject_Then_AllMethodInvoked_Subject>(sut)); } }
public When_SimulateLifetimeOfObject_Then_AllMethodInvoked_Subject(LifeTimeCounter counter) { _counter = counter; Initialize(); }