public void DoWorkCallSetsCurrentTaskStateToFailedIfExceptionOrrurs() { mockFFMPegService = new Mock <IFFMpegService>(); mockFFMPegService.Setup(m => m.PostAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ObservableCollection <AudioDestinationFormat> >(), null, null)) .Returns(Guid.NewGuid()); FFMpegClient.FfmpegJobModel job = new FFMpegClient.FfmpegJobModel() { State = FfmpegJobModelState.Done, Tasks = new ObservableCollection <FfmpegTaskModel>() { new FfmpegTaskModel() { DestinationFilename = "\\\\sdfsdfsdf\\sdfgsdf\\1_64.mp3" } } }; mockFFMPegService.Setup(m => m.GetAudioJob(It.IsAny <Guid>())).Returns(job); sut = new FFMpeg.FFMpeg(_pluginUrn, MockTimeProvider.Object, Logging, mockFFMPegService.Object, mockPresetProvider.Object); Task.To.Path = "\\\\NOT ALIKE AT ALL"; // Forces exception sut.Assign(Task); sut.Pulse(Task); Assert.That(Task.State, Is.EqualTo(ExecutionState.Failed)); }
public void DoWorkAddsCorrectNumberOfFilenamesToCurrentTask() { mockFFMPegService = new Mock <IFFMpegService>(); mockFFMPegService.Setup(m => m.PostMuxAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(Guid.NewGuid()); FFMpegClient.FfmpegJobModel job = new FFMpegClient.FfmpegJobModel() { State = FfmpegJobModelState.Done, Tasks = new ObservableCollection <FfmpegTaskModel> { new FfmpegTaskModel { DestinationFilename = "\\\\sdfsdfsdf\\sdfgsdf\\test.mp4" } } }; mockFFMPegService.Setup(m => m.GetAudioJob(It.IsAny <Guid>())).Returns(job); sut = new FFMpeg.FFMpeg(_pluginUrn, MockTimeProvider.Object, Logging, mockFFMPegService.Object, mockPresetProvider.Object); Task.To.Path = "\\\\sdfsdfsdf\\sdfgsdf"; sut.Assign(Task); sut.Pulse(Task); Assert.That(sut.GetStatus().CurrentTask.To.Files.Count, Is.EqualTo(1)); }
public void DoWorkDoesNotSetTargetFilesIfExecutionStateIsNotDone(FfmpegJobModelState FfmpegJobModel) { mockFFMPegService = new Mock <IFFMpegService>(); mockFFMPegService.Setup(m => m.PostMuxAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(Guid.NewGuid()); FFMpegClient.FfmpegJobModel job = new FFMpegClient.FfmpegJobModel() { State = FfmpegJobModel }; mockFFMPegService.Setup(m => m.GetAudioJob(It.IsAny <Guid>())).Returns(job); sut = new FFMpeg.FFMpeg(_pluginUrn, MockTimeProvider.Object, Logging, mockFFMPegService.Object, mockPresetProvider.Object); sut.Assign(Task); sut.Pulse(Task); Assert.That(Task.To.Files, Is.Empty); }
public void DoWorkDoesNotCallFFMPegServicePostIfForeignIsKeyNotEmpty(string foreignKey) { mockFFMPegService = new Mock <IFFMpegService>(); mockFFMPegService.Setup(m => m.PostAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IList <AudioDestinationFormat> >(), null, null)) .Returns(Guid.NewGuid()); FFMpegClient.FfmpegJobModel job = new FFMpegClient.FfmpegJobModel() { State = FfmpegJobModelState.InProgress }; mockFFMPegService.Setup(m => m.GetAudioJob(It.IsAny <Guid>())).Returns(job); Task.ForeignKey = foreignKey; sut = new FFMpeg.FFMpeg(_pluginUrn, MockTimeProvider.Object, Logging, mockFFMPegService.Object, mockPresetProvider.Object); sut.Assign(Task); sut.Pulse(Task); mockFFMPegService.Verify(m => m.PostAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <ObservableCollection <AudioDestinationFormat> >(), null, null), Times.Never); }
public void DoWorkCallsFFMPegServiceMuxPostIfForeignKeyIsNullOrEmpty(string foreignKey) { mockFFMPegService = new Mock <IFFMpegService>(); mockFFMPegService.Setup(m => m.PostMuxAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(Guid.NewGuid()); FFMpegClient.FfmpegJobModel job = new FFMpegClient.FfmpegJobModel() { State = FfmpegJobModelState.InProgress }; mockFFMPegService.Setup(m => m.GetAudioJob(It.IsAny <Guid>())).Returns(job); Task.ForeignKey = foreignKey; sut = new FFMpeg.FFMpeg(_pluginUrn, MockTimeProvider.Object, Logging, mockFFMPegService.Object, mockPresetProvider.Object); sut.Assign(Task); sut.Pulse(Task); mockFFMPegService.Verify(m => m.PostMuxAudioJob(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); }