public void Add_repo_file() { var syncTable = new List<SyncTableEntry>(); var sut = new LocalSyncTable(REPO_PATH, syncTable); sut.AddOrUpdateEntry(new RepoFile{Id="myid", RelativeFileName="myfn", User="******", TimeStamp=new DateTime(2000,5,12)}); Equalidator.AreEqual(syncTable, new List<SyncTableEntry> { new SyncTableEntry{ Id = "myid", RelativeFilename = "myfn", User = "******", TimeStamp = new DateTime(2000, 5, 12) } }); }
public void Save_synctable_after_each_update() { Directory.CreateDirectory(REPO_PATH); File.Delete(REPO_PATH + @"\.sync"); var sut = new LocalSyncTable(REPO_PATH); sut.AddOrUpdateEntry(new RepoFile { Id = "myid", RelativeFileName = "myfn", User = "******", TimeStamp = new DateTime(2000, 5, 12) }); Assert.AreEqual("myfn\tmyid\tmyuser\t2000-05-12T00:00:00\r\n", File.ReadAllText(REPO_PATH + @"\.sync")); }
public void Load_sync_table_on_creation() { Directory.CreateDirectory(REPO_PATH); File.WriteAllText(REPO_PATH + @"\.sync", "myfn\tmyid\tmyuser\t2000-05-12T00:00:00\r\n"); var sut = new LocalSyncTable(REPO_PATH); sut.AddOrUpdateEntry(new RepoFile { Id = "myid2", RelativeFileName = "myfn2", User = "******", TimeStamp = new DateTime(1999, 12, 31) }); Assert.AreEqual("myfn\tmyid\tmyuser\t2000-05-12T00:00:00\r\nmyfn2\tmyid2\tmyuser2\t1999-12-31T00:00:00\r\n", File.ReadAllText(REPO_PATH + @"\.sync")); }