Esempio n. 1
0
        public void CollectRepoFiles()
        {
            var syncTable = new List<SyncTableEntry> {
                                                        new SyncTableEntry { Id = "myid", User="******", TimeStamp=new DateTime(1999,12,31), RelativeFilename = "myfn" },
                                                        new SyncTableEntry { Id = "myid2", User="******", TimeStamp=new DateTime(2000,5,12), RelativeFilename = "myfn2" }
                                                     };
            var sut = new RemoteSyncTable(REPO_PATH, syncTable);

            var repoFiles = new List<RepoFile>();
            sut.CollectRepoFiles(repoFiles.Add);

            Equalidator.AreEqual(repoFiles, new List<RepoFile> {
                                                        new RepoFile{Id="myid", User="******", TimeStamp=new DateTime(1999,12,31), RelativeFileName="myfn"},
                                                        new RepoFile{Id="myid2", User="******", TimeStamp=new DateTime(2000,5,12), RelativeFileName="myfn2"}
                                                  });
        }
Esempio n. 2
0
        public void Load_sync_table_upon_creation()
        {
            var sut = new RemoteSyncTable(REPO_PATH, new List<SyncTableEntry>());
            var rf = new RepoFile { Id = "myid", User = "******", TimeStamp = new DateTime(2000, 5, 12), RelativeFileName = "myfn" };
            sut.AddEntry(rf);

            sut = new RemoteSyncTable(REPO_PATH);

            RepoFile result = null;
            sut.CollectRepoFiles(_ => result = _);
            Equalidator.AreEqual(rf, result);

            sut.UpdateEntry(new RepoFile { Id = "myid2", User = "******", TimeStamp = new DateTime(1999, 12, 31), RelativeFileName = "myfn" }, _ => { }, null);
            Assert.AreEqual("myfn\tmyid2\tmyuser2\t1999-12-31T00:00:00\r\n", File.ReadAllText(REPO_PATH + @"\.sync"));
        }