BlogSharp.Core.Impl.Tests.Services.FileSystem.TransactionalFileServiceTests.File_should_exist_outside_of_transaction_after_commit C# (CSharp) Méthode

File_should_exist_outside_of_transaction_after_commit() private méthode

private File_should_exist_outside_of_transaction_after_commit ( ) : void
Résultat void
        public void File_should_exist_outside_of_transaction_after_commit()
        {
            string fileName = "newFile.file";
            string currentlyExistingFile = assemblyFile;
            string nonExistingFile = "blah.file";
            System.IO.File.Delete(fileName);
            System.IO.File.Delete(nonExistingFile);
            using (var scope = new TransactionScope())
            {
                fileService.CreateFile(fileName);
                Assert.True(fileService.FileExists(fileName));
                Assert.False(System.IO.File.Exists(fileName), "This file shouldn't exist out of transaction");
                scope.Complete();
            }

            Assert.True(System.IO.File.Exists(fileName), "The file should exist since the scope is completed");
        }