We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<text> @Tag("IList") @Tag("Memory") @TestAttribute public void @(Test.ClassName + "_ListT_" + itemType.SafeName + "_AddClear_Memory") () { IList<@itemType.FullName> objectUnderTest = CreateObject(); if (objectUnderTest.IsReadOnly) return; Func<WeakReference> run = () => { @itemType.FullName newItem; try { newItem = @itemType.GetConstructorCode(); objectUnderTest.Add(newItem); return new WeakReference(newItem); } catch (ArgumentException) { return null; } }; var wr = run(); if (wr == null) return; //test inconclusive //release strong references objectUnderTest.Clear(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); //verify the object was collected Assert.IsFalse(wr.IsAlive); } @Tag("IList") @Tag("Memory") @TestAttribute public void @(Test.ClassName + "_ListT_" + itemType.SafeName + "_AddRemove_Memory") () { IList<@itemType.FullName> objectUnderTest = CreateObject(); if (objectUnderTest.IsReadOnly) return; var oldCount = objectUnderTest.Count; Func<WeakReference> run = () => { @itemType.FullName newItem; try { newItem = @itemType.GetConstructorCode(); objectUnderTest.Add(newItem); return new WeakReference(newItem); } catch (ArgumentException) { return null; } }; var wr = run(); if (wr == null) return; //test inconclusive //release strong references Action run2 = () => { objectUnderTest.Remove((@itemType.FullName)wr.Target); }; run2(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); //verify the object was collected Assert.IsFalse(wr.IsAlive); } @Tag("IList") @Tag("Memory") @TestAttribute public void @(Test.ClassName + "_ListT_" + itemType.SafeName + "_AddRemoveAt_Memory") () { IList<@itemType.FullName> objectUnderTest = CreateObject(); if (objectUnderTest.IsReadOnly) return; Func<WeakReference> run = () => { @itemType.FullName newItem; try { newItem = @itemType.GetConstructorCode(); objectUnderTest.Add(newItem); return new WeakReference(newItem); } catch (ArgumentException) { return null; } }; var wr = run(); if (wr == null) return; //test inconclusive //release strong references //release strong references Action run2 = () => { var newIndex = objectUnderTest.IndexOf((@itemType.FullName)wr.Target); objectUnderTest.RemoveAt(newIndex); }; run2(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); //verify the object was collected Assert.IsFalse(wr.IsAlive); } </text>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: