public void Given_a_valid_request_When_Mark_As_No_Longer_Required_Then_should_call_appropriate_methods()
        {
            // Given
            var target = CreateRiskAssessmentFurtherActionService();

            var request = new MarkTaskAsNoLongerRequiredRequest()
                              {
                                  CompanyId = 1,
                                  TaskId = 4,
                                  UserId = Guid.NewGuid()
                              };


            _userRepository
                .Setup(x => x.GetByIdAndCompanyId(request.UserId, request.CompanyId))
                .Returns(_user);

            var task = new Mock<Task>();

            _tasksRepo
                .Setup(x => x.GetById(request.TaskId))
                .Returns(task.Object);

            // When
            target.MarkTaskAsNoLongerRequired(request);

            //Then
            _userRepository.Verify(x => x.GetByIdAndCompanyId(request.UserId, request.CompanyId), Times.Once());
            _tasksRepo.Verify(x => x.SaveOrUpdate(task.Object));
            task.Verify(x => x.MarkAsNoLongerRequired(_user));
        }
Exemplo n.º 2
0
        public void MarkTaskAsNoLongerRequired(MarkTaskAsNoLongerRequiredRequest request)
        {
            _log.Add(request);

            var user = _userForAuditingRepository.GetByIdAndCompanyId(request.UserId, request.CompanyId);

            var task = _taskRepository.GetById(request.TaskId);
            task.MarkAsNoLongerRequired(user);

            _taskRepository.SaveOrUpdate(task);
        }