Exemplo n.º 1
0
        public void CopyIfNewerDestinationDoesNotExist()
        {
            File.WriteAllText(this.file1, "file");
            Copier copier = new Copier(new MemoryLog());

            copier.TryCopyIfNewer(this.file1, this.file2).Should().BeTrue();
            File.ReadAllText(this.file2).Should().Be("file");
        }
Exemplo n.º 2
0
 public void CopyIfNewerSourceDoesNotExist()
 {
     Action action = () =>
         {
             Copier copier = new Copier(new MemoryLog());
             copier.TryCopyIfNewer(this.file1, this.file2);
         };
     action.ShouldThrow<FileNotFoundException>();
 }
Exemplo n.º 3
0
        public void CopyIfNewerSameTime()
        {
            File.WriteAllText(this.file1, "file1");
            File.Copy(this.file1, this.file2);
            Copier copier = new Copier(new MemoryLog());

            copier.TryCopyIfNewer(this.file1, this.file2).Should().BeFalse();
            File.ReadAllText(this.file2).Should().Be("file1");
        }
Exemplo n.º 4
0
        public void CopyIfNewerSourceOlder()
        {
            File.WriteAllText(this.file1, "file1");
            Thread.Sleep(5);
            File.WriteAllText(this.file2, "file2");
            Copier copier = new Copier(new MemoryLog());

            copier.TryCopyIfNewer(this.file1, this.file2).Should().BeFalse();
            File.ReadAllText(this.file2).Should().Be("file2");
        }