Exemple #1
0
        public void DontCopyIfSourceIsTargetFile()
        {
            var photo      = PhotoMock.Create(targetUri);
            var fileSystem = new FileSystemMock();
            var tracker    = new PhotoFileTracker(fileSystem);

            tracker.CopyIfNeeded(photo, targetBase);

            Assert.AreEqual(0, tracker.OriginalFiles.Count());
            Assert.AreEqual(0, tracker.CopiedFiles.Count());
            Assert.AreEqual(targetUri, photo.DefaultVersion.Uri);
            fileSystem.FileMock.Verify(f => f.Copy(It.IsAny <Uri> (), It.IsAny <Uri> (), It.IsAny <bool> ()), Times.Never);
        }
Exemple #2
0
        public void CopyNewFile()
        {
            var photo      = PhotoMock.Create(sourceUri);
            var fileSystem = new FileSystemMock();
            var tracker    = new PhotoFileTracker(fileSystem);

            tracker.CopyIfNeeded(photo, targetBase);

            CollectionAssert.AreEquivalent(new[] { sourceUri }, tracker.OriginalFiles);
            CollectionAssert.AreEquivalent(new[] { targetUri }, tracker.CopiedFiles);
            Assert.AreEqual(targetUri, photo.DefaultVersion.Uri);
            fileSystem.FileMock.Verify(f => f.Copy(sourceUri, targetUri, false), Times.Once);
        }
Exemple #3
0
        public void PhotoWithVersionsAndXmpIsCopied()
        {
            var photo      = PhotoMock.Create(sourceUri, rawUri);
            var fileSystem = new FileSystemMock(xmpSourceUri);
            var tracker    = new PhotoFileTracker(fileSystem);

            tracker.CopyIfNeeded(photo, targetBase);

            CollectionAssert.AreEquivalent(new[] { sourceUri, rawUri, xmpSourceUri }, tracker.OriginalFiles);
            CollectionAssert.AreEquivalent(new[] { targetUri, targetRawUri, xmpTargetUri }, tracker.CopiedFiles);
            Assert.AreEqual(targetUri, photo.DefaultVersion.Uri);
            Assert.AreEqual(targetRawUri, photo.Versions.ElementAt(1).Uri);
            fileSystem.FileMock.Verify(f => f.Copy(sourceUri, targetUri, false), Times.Once);
            fileSystem.FileMock.Verify(f => f.Copy(rawUri, targetRawUri, false), Times.Once);
            fileSystem.FileMock.Verify(f => f.Copy(xmpSourceUri, xmpTargetUri, true), Times.Once);
        }