public void MkvConvertor_ValidFilePath_SuccessObjectCreated() { // Arrange var file = _filePath + "test1.mkv"; // Act var mkvConvertor = new MkvConvertor(file); // Assert Assert.IsNotNull(mkvConvertor); }
public void Convert_ValidDestinationPath_SuccessDestinationFileCreated() { // Arrange var file = _filePath + "test1.mkv"; var destinationFile = file + ".mp4"; var mkvConvertor = new MkvConvertor(file); // Act mkvConvertor.Convert(destinationFile); // Assert Assert.IsNotNull(mkvConvertor); Assert.IsTrue(System.IO.File.Exists(destinationFile)); }
public void Convert_ValidDestinationPathFileLocked_FailureNoFileCreated() { // Arrange var file = _filePath + "test1.mkv"; var destinationFile = file + ".mp4"; var mkvConvertor1 = new MkvConvertor(file); // Act mkvConvertor1.Convert(destinationFile); mkvConvertor1.Convert(destinationFile); // Assert Assert.IsNotNull(mkvConvertor1); Assert.IsFalse(System.IO.File.Exists(destinationFile)); }
private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs) { if (!IODirectory.Exists(_options.DirectoryPath)) return; var mkvFiles = IODirectory.GetFiles( _options.DirectoryPath, "*.mkv", SearchOption.AllDirectories); Parallel.ForEach(mkvFiles, file => { var mkvConvertor = new MkvConvertor(file); var destinationPath = string.Format("{0}.MP4", file); DirectoryMonitorLog.LogToEventViewer(string.Format("Processing File: {0}", file)); mkvConvertor.Convert(destinationPath); DirectoryMonitorLog.LogToEventViewer(string.Format("Processing File Completed: {0}", file)); MoveFileToFinishedDirectory(file); }); }