public void TxJournalEntry_Operation_EqualsOperationPassed()
        {
            var mockFileSystem    = new MockFileSystem();
            var txFileSystem      = new TxFileSystem(mockFileSystem);
            var unitTestOperation = new UnitTestDirectoryOperation(txFileSystem.Directory,
                                                                   "/var/journaltestdir");

            var txJournalEntry = new TxJournalEntry(unitTestOperation);

            Assert.Equal(unitTestOperation, txJournalEntry.Operation);
            Assert.Equal(OperationType.Delete, txJournalEntry.Operation.OperationType);
        }
Exemplo n.º 2
0
        public void TxJournal_Add_Results_FirstEntryOperationType_ReturnsInfo()
        {
            var mockFileSystem = new MockFileSystem();

            TxJournalEntry firstJournalEntry = null;

            using (var transactionScope = new TransactionScope())
            {
                var txFileSystem = new TxFileSystem(mockFileSystem);
                var txJournal    = txFileSystem.Journal;
                txJournal.Add(new UnitTestDirectoryOperation(txFileSystem.Directory,
                                                             "/var/journaltestdir"));

                firstJournalEntry = txJournal._txJournalEntries.First();
            }

            Assert.Equal(OperationType.Delete, firstJournalEntry.Operation.OperationType);
        }
        public void TxJournalEntryCollection_Remove_ThrowsNotImplementedException()
        {
            var attr = (FsFactAttribute)Attribute.GetCustomAttribute(MethodBase.GetCurrentMethod(),
                                                                     typeof(FsFactAttribute));
            var fileSystemMock = attr.GetMock <IFileSystem>();
            var txFileSystem   = new TxFileSystem(fileSystemMock.Object);

            var path = "/tmp/dummydirectory";
            var unitTestOperation = new UnitTestDirectoryOperation(txFileSystem.Directory, path);
            var journalEntry      = new TxJournalEntry(unitTestOperation);
            var journalEntries    = new TxJournalEntryCollection
            {
                journalEntry
            };

            Assert.Throws <NotImplementedException>(() =>
            {
                journalEntries.Remove(journalEntry);
            });
        }