예제 #1
0
        public void GetTaskResult_when_task_exists_returns_valid_result()
        {
            var groupId = Guid.NewGuid();
            var taskId  = Guid.NewGuid();
            var mapper  = _container.Resolve <IMapper>();


            var progress = new ImgTaskProgress(taskId, groupId, ImgTaskState.Completed);
            var result   = new ImgTaskResult(taskId, groupId, new MemoryStream(new byte[] { 1, 2, 3 }), "png");

            _dbContext.DbImgTaskProgress.Add(mapper.Map <ImgTaskProgress, DbImgTaskProgress>(progress));
            _dbContext.DbImgTaskResult.Add(mapper.Map <ImgTaskResult, DbImgTaskResult>(result));
            _dbContext.SaveChanges();

            var foundResult = _imgTaskResultRepository.GeTaskResult(groupId, taskId);

            foundResult.ImgStream.Length.Should().BeGreaterThan(0);
            foundResult.ImgStream.CanRead.Should().BeTrue();
            foundResult.Should().BeEquivalentTo(result,
                                                options => { return(options.Excluding(taskResult => taskResult.ImgStream)); });
        }
예제 #2
0
        public ImgTaskResult GetTaskResult(Guid groupId, Guid taskId)
        {
            var result = _imgTaskResultRepository.GeTaskResult(groupId, taskId);

            return(result);
        }