public void GetInfo_EmptyDest_SingleFileWillBeCopied() { using (var from = new TemporaryFolder("synctest_source")) using (var to = new TemporaryFolder("synctest_dest")) { System.IO.File.WriteAllText(from.Combine("test1.txt"), "Blah blah"); System.IO.File.WriteAllText(from.Combine("test2.txt"), "Blah blah blah"); var source = new RawDirectorySource(from.Path); var groups = new List <FileSource>(new[] { source }); var sync = new Synchronizer(to.Path, groups, 100); sync.GatherInformation(); Assert.AreEqual(0, source.UpdateFileCount); Assert.AreEqual(0, source.DeleteFileCount); Assert.AreEqual(2, source.NewFileCount); Assert.AreEqual(23, source.NetChangeInBytes); } }
public void DoSynchronization_FileRemoved_FileGetsDeletedFromDest() { using (var from = new TemporaryFolder("synctest_source")) using (var to = new TemporaryFolder("synctest_dest")) { File.WriteAllText(from.Combine("test1.txt"), "Blah blah"); var source = new RawDirectorySource(from.Path); var groups = new List <FileSource>(new[] { source }); var sync = new Synchronizer(to.Path, groups, 100); sync.GatherInformation(); sync.DoSynchronization(); File.Delete(from.Combine("test1.txt")); sync.GatherInformation(); Assert.IsTrue(File.Exists(to.Combine("test1.txt"))); sync.DoSynchronization(); Assert.IsFalse(File.Exists(to.Combine("test1.txt"))); } }
public void GetInfo_FileRemoved_WillBeDeleted() { using (var from = new TemporaryFolder("synctest_source")) using (var to = new TemporaryFolder("synctest_dest")) { File.WriteAllText(from.Combine("test1.txt"), "Blah blah"); var source = new RawDirectorySource(from.Path); var groups = new List <FileSource>(new[] { source }); var sync = new Synchronizer(to.Path, groups, 100); sync.GatherInformation(); sync.DoSynchronization(); File.Delete(from.Combine("test1.txt")); sync.GatherInformation(); Assert.AreEqual(0, source.NewFileCount); Assert.AreEqual(0, source.UpdateFileCount); Assert.AreEqual(1, source.DeleteFileCount); Assert.AreEqual(-9, source.NetChangeInBytes); } }