public static void Dispose()
        {
#if DEBUG
            Console.WriteLine("Dispose");
#endif
            var managedPath =
                "Data" +
                Path.DirectorySeparatorChar +
                "edit-file-already-exists-dispose.txt";

            // Simulate a preparation

            var manager = new EditExistingFileManager(
                managedPath);

            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()
            {
#if DEBUG
                Console.WriteLine("FileAlreadyExists_OnRollbackNoScope");
#endif
                var managedPath =
                    "Data" +
                    Path.DirectorySeparatorChar +
                    "edit-file-already-exists-on-rollback-no-scope.txt";

                // Simulate a preparation

                var manager = new EditExistingFileManager(
                    managedPath);

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

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

                // Simulate a rollback (NOP)

                // We want to access the managed file to inspect its
                // edited contents, hence we need to dispose
                // its manager.
                manager.Dispose();

                // Expected results

                Assert.IsTrue(File.Exists(managedPath));
                using (stream = File.OpenRead(managedPath))
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        var content = reader.ReadLine();
                        Assert.AreEqual("existing-file", content);
                    }
                }
            }