Пример #1
0
        public void Delete_entries_while_collecting()
        {
            var syncTable = new List<SyncTableEntry>
                {
                    new SyncTableEntry {RelativeFilename = "myfn", Id = "myid"},
                    new SyncTableEntry {RelativeFilename = "myfn2", Id = "myid2"}
                };
            var sut = new LocalSyncTable(REPO_PATH, syncTable);

            sut.CollectRepoFiles(_ => sut.DeleteEntry(_));

            Assert.AreEqual(0, syncTable.Count);
        }
Пример #2
0
        public void Delete_entry()
        {
            var sut = new LocalSyncTable(REPO_PATH, new List<SyncTableEntry>
                {
                    new SyncTableEntry { RelativeFilename = "myfn", Id = "myid" },
                    new SyncTableEntry { RelativeFilename = "myfn2", Id = "myid2" }
                });

            var rf = new RepoFile {RelativeFileName = "myfn2"};
            var result = sut.DeleteEntry(rf);

            Equalidator.AreEqual(result, rf);
        }
Пример #3
0
        public void Sync_table_is_persisted_after_delete()
        {
            Directory.CreateDirectory(REPO_PATH);
            File.Delete(REPO_PATH + @"\.sync");

            var sut = new LocalSyncTable(REPO_PATH, new List<SyncTableEntry>
                {
                    new SyncTableEntry { RelativeFilename = "myfn", Id = "myid", User = "******", TimeStamp = new DateTime(2000,5,12)},
                    new SyncTableEntry { RelativeFilename = "myfn2", Id = "myid2" }
                });

            var rf = new RepoFile { RelativeFileName = "myfn2" };
            var result = sut.DeleteEntry(rf);

            Assert.AreEqual("myfn\tmyid\tmyuser\t2000-05-12T00:00:00\r\n", File.ReadAllText(REPO_PATH + @"\.sync"));
        }