public void TestPublicNestedClassInternalNamedMethod() { Reset(); const int index = 99; _itemPublic = new PublicNestedTestClass(index); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetAction(WeakActionTestCase.InternalNamedMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.Internal + index, PublicNestedTestClass.Result); _itemPublic = 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 TestPublicNestedClassPublicNamedMethod() { Reset(); const int index = 99; _itemPublic = new PublicNestedTestClass(index); _action = _itemPublic.GetAction(WeakActionTestCase.PublicNamedMethod); _reference = new WeakReference(_itemPublic); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.Public + index, PublicNestedTestClass.Result); _itemPublic = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestPublicNestedClassPublicStaticMethod() { Reset(); _itemPublic = new PublicNestedTestClass(); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetFunc(WeakActionTestCase.PublicStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); var result = _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.PublicStatic, PublicNestedTestClass.Result); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.PublicStatic, result); _itemPublic = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestPublicNestedClassPublicStaticMethod() { Reset(); _itemPublic = new PublicNestedTestClass(); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetFunc(WeakActionTestCase.PublicStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); var result = _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.PublicStatic, PublicNestedTestClass.Result); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.PublicStatic, result); _itemPublic = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestPublicNestedClassInternalNamedMethod() { Reset(); const int index = 99; _itemPublic = new PublicNestedTestClass(index); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetFunc(WeakActionTestCase.InternalNamedMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); var result = _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.Internal + index, PublicNestedTestClass.Result); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.Internal + index, result); _itemPublic = 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 TestPublicClassPublicStaticMethod() { Reset(); const string parameter = "My parameter"; _itemPublic = new PublicNestedTestClass <string>(); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetFunc(WeakActionTestCase.PublicStaticMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); var result = _action.Execute(parameter); Assert.AreEqual( PublicNestedTestClass <string> .Expected + PublicNestedTestClass <string> .PublicStatic + parameter, PublicNestedTestClass <string> .Result); Assert.AreEqual( PublicNestedTestClass <string> .Expected + PublicNestedTestClass <string> .PublicStatic + parameter, result); _itemPublic = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
private void Reset() { _itemPublic = null; _itemInternal = null; _itemPrivate = null; _reference = null; }
public void TestPublicNestedClassPublicNamedMethod() { Reset(); const int index = 99; _itemPublic = new PublicNestedTestClass(index); _action = _itemPublic.GetAction(WeakActionTestCase.PublicNamedMethod); _reference = new WeakReference(_itemPublic); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(); Assert.AreEqual( PublicNestedTestClass.Expected + PublicNestedTestClass.Public + index, PublicNestedTestClass.Result); _itemPublic = null; GC.Collect(); Assert.IsFalse(_reference.IsAlive); }
public void TestPublicClassInternalNamedMethod() { Reset(); const string parameter = "My parameter"; const int index = 99; _itemPublic = new PublicNestedTestClass <string>(index); _reference = new WeakReference(_itemPublic); _action = _itemPublic.GetAction(WeakActionTestCase.InternalNamedMethod); Assert.IsTrue(_reference.IsAlive); Assert.IsTrue(_action.IsAlive); _action.Execute(parameter); Assert.AreEqual( PublicNestedTestClass <string> .Expected + PublicNestedTestClass <string> .Internal + index + parameter, PublicNestedTestClass <string> .Result); _itemPublic = 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 }
private void Reset() { #if !WP70 _itemPublic = null; #endif _itemInternal = null; _itemPrivate = null; _reference = null; }
private void Reset() { #if !WP70 _itemPublic = null; #endif _itemInternal = null; _itemPrivate = null; _reference = null; }
private void Reset() { _itemPublic = null; _itemInternal = null; _itemPrivate = null; _reference = null; }