Example #1
0
        public void MoveVideoItemTestCaseRenameKo(int minutes, string fallbackDir)
        {
            const string Filename = "Unknown Video.mkv";

            var videoSrcPath = Path.Combine(settings.DownloadsPath, TestHelper.Uid(), Filename);

            TestHelper.CreateFile(videoSrcPath);

            var duration = TimeSpan.FromMinutes(minutes);

            mediaInfoMock.Setup(x => x.TryGetDuration(It.IsAny <string>(), out duration)).Returns(true);

            filebotMock.Setup(x => x.Rename(It.IsAny <RenameRequest>())).Returns(new RenameResult {
                Succeeded = false
            });

            var mover        = new MediaLibraryMover(settingsMock.Object, loggerMock.Object, filebotMock.Object, mediaInfoMock.Object, archiveMock.Object);
            var movedFsItems = mover.MoveVideoFile(videoSrcPath);

            var videoDestPath = Path.Combine(settings.MediaLibraryPath, fallbackDir, Filename);

            Assert.IsTrue(File.Exists(videoDestPath), "Dest video file was not created");
            Assert.IsFalse(File.Exists(videoSrcPath), "Src video is still present");
            Assert.AreEqual(1, movedFsItems.Count);
            Assert.AreEqual(videoDestPath, movedFsItems.First().FullName);
        }
Example #2
0
        public void MoveVideoItemTestCaseRenameOk()
        {
            var videoSrcPath = Path.Combine(settings.DownloadsPath, TestHelper.Uid(), "the.big.bang.theory.s10.e01.mp4");

            TestHelper.CreateFile(videoSrcPath);

            var videoDestPath = Path.Combine(settings.MediaLibraryPath, "TV Shows", "The Big Bang Theory", "Season 10", "The Big Bang Theory - S10E01 - The Conjugal Conjecture.mp4");

            filebotMock.Setup(x => x.Rename(It.IsAny <RenameRequest>())).Returns(new RenameResult {
                Succeeded = true, DestPath = videoDestPath
            });
            var mover   = new MediaLibraryMover(settingsMock.Object, loggerMock.Object, filebotMock.Object, mediaInfoMock.Object, archiveMock.Object);
            var fsItems = mover.MoveVideoFile(videoSrcPath);

            Assert.AreEqual(3, fsItems.Count, "Tbbt folder and season folder should be created");
            Assert.IsTrue(File.Exists(videoDestPath), "Dest video file was not created");
            Assert.IsFalse(File.Exists(videoSrcPath), "Src video is still present");
        }