public void FinishExistVideoTest() { //Arrange var videoMsg = new VideoMessage(); var finishProcess = new FinishProcess(_queueVideoRepository.Object, _videoRepository.Object, _fileSystem.Object); _videoRepository.Setup(m => m.ExistsEncodedVideo(It.IsAny <string>())).Returns(true); var uploadInfo = new UploadInformation() { DownloadInformation = new DownloadInformation() { QueueInformation = new QueueInformation() { VideoMessage = videoMsg } } }; //Act finishProcess.ProcessMethod(uploadInfo, new CancellationToken()); //Assert _videoRepository.Verify(m => m.SetEncodingState(It.IsAny <string>(), EncodingState.InProcess, EncodingStage.CleanUp, null), Times.Once()); _videoRepository.Verify(m => m.ExistsEncodedVideo(It.IsAny <string>()), Times.Once()); _fileSystem.Verify(m => m.DirectoryDelete(It.IsAny <string>()), Times.Never()); _queueVideoRepository.Verify(m => m.DeleteMessage(videoMsg)); _videoRepository.Verify(m => m.SetEncodingState(It.IsAny <string>(), EncodingState.Successed, EncodingStage.CleanUp, null), Times.Once()); }
public void FinishNotExistVideoTest() { //Arrange var videoMsg = new VideoMessage(); var finishProcess = new FinishProcess(_queueVideoRepository.Object, _videoRepository.Object, _fileSystem.Object); _videoRepository.Setup(m => m.ExistsEncodedVideo(It.IsAny<string>())).Returns(false); var uploadInfo = new UploadInformation() { DownloadInformation = new DownloadInformation() { QueueInformation = new QueueInformation() { VideoMessage = videoMsg } } }; //Act finishProcess.ProcessMethod(uploadInfo, new CancellationToken()); //Assert _videoRepository.Verify(m => m.SetEncodingState(It.IsAny<string>(),EncodingState.InProcess, EncodingStage.CleanUp, null), Times.Once()); _videoRepository.Verify(m=>m.ExistsEncodedVideo(It.IsAny<string>()), Times.Once()); _fileSystem.Verify(m => m.DirectoryDelete(It.IsAny<string>()), Times.Once()); _queueVideoRepository.Verify(m => m.DeleteMessage(videoMsg)); _videoRepository.Verify(m => m.SetEncodingState(It.IsAny<string>(), EncodingState.Successed, EncodingStage.CleanUp, null), Times.Once()); }
public void FinishSuccessfulTest() { //Arrange var videoMssg = new VideoMessage(); var finishProcess = new FinishProcess(_queueVideoRepository.Object, _videoRepository.Object, _fileSystem.Object); var uploadInfo = new UploadInformation() { DownloadInformation = new DownloadInformation() { QueueInformation = new QueueInformation() { VideoMessage = new VideoMessage() } } }; //Act var obj = finishProcess.ProcessMethod(uploadInfo, new CancellationToken()); //Assert Assert.AreEqual(null, obj); }