예제 #1
0
        public void IsStatic_ReturnsFalse <TIn, TOut>(
            TIn inputParameter,
            TOut outputParameter)
        {
            var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TIn, TOut>();

            Assert.False(weakFunc.IsStatic);
        }
예제 #2
0
        public void IsAlive_AfterGarbageCollection_ReturnsTrue <TOut>(TOut outputParameter)
        {
            var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TOut>();

            GC.Collect();

            Assert.True(weakFunc.IsAlive);
        }
예제 #3
0
        public void Execute_AfterGarbageCollection_InvokesFunc <TOut>(TOut outputParameter)
        {
            var callCounter = Substitute.For <ICallCounter>();

            using (StaticWeakDelegatesCallCounter.WithCallCounter(callCounter))
            {
                var weakFunc = StaticWeakDelegatesCallCounter.GetWeakAnonymousFuncWithStaticReference <TOut>();

                GC.Collect();
                weakFunc.Execute();

                callCounter.Received(1).OnFuncCalled <TOut>();
            }
        }