Exemplo n.º 1
0
        string Foo()
        {
            MyTemporaryFile file     = new MyTemporaryFile();
            var             fileName = file.FileName;

            return(fileName);
        }
Exemplo n.º 2
0
        public void Test_Dispose()
        {
            MyTemporaryFile file     = new MyTemporaryFile();
            string          fileName = file.FileName;

            Assert.That(File.Exists(fileName), Is.True);
            file.Dispose();
            Assert.That(File.Exists(fileName), Is.False);
            GC.Collect();
            GC.WaitForPendingFinalizers();
            Assert.That(File.Exists(fileName), Is.False);
        }
Exemplo n.º 3
0
        public void Test_using()
        {
            string fileName;

            using (MyTemporaryFile file = new MyTemporaryFile())
            {
                fileName = file.FileName;
                Assert.That(File.Exists(fileName), Is.True);
            }
            Assert.That(File.Exists(fileName), Is.False);
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }