public void TestInternalClassAnonymousStaticMethod() { Reset(); const string parameter = "My parameter"; _itemInternal = new InternalTestClass <string>(); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(parameter); Assert.AreEqual( InternalTestClass <string> .Expected + parameter, InternalTestClass <string> .Result); _itemInternal = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestInternalClassPrivateNamedMethod() { Reset(); const int index = 99; _itemInternal = new InternalTestClass(index); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.PrivateNamedMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(); Assert.AreEqual( InternalTestClass.Expected + InternalTestClass.Private + index, InternalTestClass.Result); _itemInternal = null; GC.Collect(); #if SILVERLIGHT Assert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed _action = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); #else Assert.IsFalse(_reference.IsAlive); #endif }
public void TestInternalClassAnonymousMethod() { Reset(); const int index = 99; const string parameter = "My parameter"; _itemInternal = new InternalTestClass <string>(index); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(parameter); Assert.AreEqual( InternalTestClass <string> .Expected + index + parameter, InternalTestClass <string> .Result); _itemInternal = null; GC.Collect(); #if SILVERLIGHT Assert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed _action = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); #else Assert.IsFalse(_reference.IsAlive); #endif }
public void TestInternalClassAnonymousStaticMethod() { Reset(); _itemInternal = new InternalTestClass(); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(); Assert.AreEqual( InternalTestClass.Expected, InternalTestClass.Result); _itemInternal = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestInternalClassAnonymousStaticMethod() { Reset(); const string parameter = "My parameter"; _itemInternal = new InternalTestClass<string>(); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(parameter); Assert.AreEqual( InternalTestClass<string>.Expected + parameter, InternalTestClass<string>.Result); _itemInternal = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestInternalClassAnonymousMethod() { Reset(); const int index = 99; const string parameter = "My parameter"; _itemInternal = new InternalTestClass<string>(index); _reference = new WeakReference(_itemInternal); _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(parameter); Assert.AreEqual( InternalTestClass<string>.Expected + index + parameter, InternalTestClass<string>.Result); _itemInternal = null; GC.Collect(); #if SILVERLIGHT Assert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed _action = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); #else Assert.IsFalse(_reference.IsAlive); #endif }