Beispiel #1
0
        public void LeakTest(string filename, int expectedLeaks)
        {
            using (var copy = new InstrumentedCopy(filename))
            {
                AssemblyLauncher.Launch(copy.FileName);
            }

            Assert.AreEqual(expectedLeaks, DisposerRegistry.LeakedObjects.Count);
        }
Beispiel #2
0
        public void CrossBoundaryLeakTest()
        {
            // This actually works, but writing test for it is a little
            // more involved. The test runner would always resolve the
            // un-instrumented LeakerLib. We'll need to use a separate
            // AppDomain
            Assert.Ignore("Test not implemented");

            using (var lib = new InstrumentedCopy("LeakerLib.dll"))
                using (var exe = new InstrumentedCopy("CrossBoundaryLeaker.exe",
                                                      lib.DirectoryName))
                {
                    AssemblyLauncher.Launch(exe.FileName);
                }

            Assert.AreEqual(1, DisposerRegistry.LeakedObjects.Count);
        }