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

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

            GC.Collect();

            Assert.True(weakFunc.IsAlive);
        }
Esempio n. 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>();
            }
        }