Ejemplo n.º 1
0
        public void EncodeExceptionHandlerTest()
        {
            //Arrange
            const string localPath     = "local path";
            var          videoMsg      = new VideoMessage();
            var          encodeProcess = new EncodeProcess(5, _encoder.Object, _videoRepository.Object, _mediaInfoReader.Object, _queueVideoRepository.Object, _fileSystem.Object);

            var downloadInfo = new DownloadInformation()
            {
                LocalPath        = localPath,
                QueueInformation = new QueueInformation()
                {
                    VideoMessage = videoMsg
                }
            };

            //Act
            encodeProcess.ExceptionHandler(new Exception(), downloadInfo);

            //Asert
            _videoRepository.Verify(m => m.SetEncodingState(It.IsAny <string>(), EncodingState.Failed, EncodingStage.Encoding, null), Times.Once());
            _fileSystem.Verify(m => m.DirectoryDelete(localPath), Times.Once());
            _queueVideoRepository.Verify(m => m.DeleteMessage(videoMsg), Times.Once());
        }
Ejemplo n.º 2
0
        public void EncodeExceptionHandlerTest()
        {
            //Arrange
            const string localPath = "local path";
            var videoMsg = new VideoMessage();
            var encodeProcess = new EncodeProcess(5, _encoder.Object, _videoRepository.Object, _mediaInfoReader.Object, _queueVideoRepository.Object, _fileSystem.Object);

             var downloadInfo = new DownloadInformation()
                                   {
                                       LocalPath=localPath,
                                       QueueInformation = new QueueInformation()
                                                              {
                                                                  VideoMessage = videoMsg
                                                              }
                                   };

            //Act
            encodeProcess.ExceptionHandler(new Exception(), downloadInfo);

            //Asert
            _videoRepository.Verify(m=>m.SetEncodingState(It.IsAny<string>(),EncodingState.Failed, EncodingStage.Encoding, null), Times.Once());
            _fileSystem.Verify(m=>m.DirectoryDelete(localPath), Times.Once());
            _queueVideoRepository.Verify(m=>m.DeleteMessage(videoMsg), Times.Once());
        }