public static void Dispose(bool overwrite)
        {
#if DEBUG
            Console.WriteLine("Dispose");
#endif
            string managedPath =
                overwrite
                ?
                "Data" +
                Path.DirectorySeparatorChar +
                "create-file-is-new-dispose.txt"
                :
                "Data" +
                Path.DirectorySeparatorChar +
                "create-file-is-new-dispose-cannot-overwrite.txt";

            // Assure that the managed file is new
            // in case of overwrite: false
            if (!overwrite)
            {
                File.Delete(managedPath);
            }

            // Simulate a preparation

            var manager = new CreateNonEmptyFileManager(
                managedPath, overwrite: overwrite);

            Assert.AreEqual(false, FileManagerReflection.GetField(manager, "disposed"));

            FileStream stream = (FileStream)FileManagerReflection.Invoke(
                manager,
                "OnPrepareFileStream",
                new string[] { managedPath });

            FileManagerReflection.SetStream(manager, stream);
            stream = null;

            // Dispose the manager

            manager.Dispose();

            // Expected results

            Assert.AreEqual(true, FileManagerReflection.GetField(manager, "disposed"));

            // Dispose the manager, again

            ExceptionAssert.IsNotThrown(
                () => { manager.Dispose(); }
                );
        }
            public static void OnRollbackNoScope(bool overwrite)
            {
#if DEBUG
                Console.WriteLine("FileIsNew_OnRollbackNoScope");
#endif
                var managedPath =
                    "Data" +
                    Path.DirectorySeparatorChar +
                    "create-file-is-new-on-rollback-no-scope.txt";

                // Simulate a preparation

                var manager = new CreateNonEmptyFileManager(
                    managedPath, overwrite: overwrite);

                FileStream stream = (FileStream)FileManagerReflection.Invoke(
                    manager,
                    "OnPrepareFileStream",
                    new string[] { managedPath });

                FileManagerReflection.SetStream(manager, stream);
                stream = null;

                Assert.AreEqual(overwrite, manager.CanOverwrite);
                Assert.AreEqual(false, manager.FileAlreadyExists);

                // Simulate a rollback

                FileManagerReflection.Invoke(
                    manager,
                    "OnRollback",
                    null);

                // Expected results

                // Dispose the manager, so that
                // the following call to File.Exists
                // has the required permissions
                // to investigate the managed file.
                manager.Dispose();

                Assert.IsTrue(!File.Exists(managedPath));
            }