Ejemplo n.º 1
0
        public async Task Should_Publish_And_Update_Entity(int workItemId)
        {
            _consumeContext.Message.Returns(new WorkItemUpdated {
                WorkItemId = workItemId, OldWorkItem = OldWorkItem, NewWorkItem = CompletelyNewWorkItem
            });

            await _handler.Consume(_consumeContext);

            await _bus.Received(1).Publish(Arg.Is <EmailSend>(
                                               x => x.To == User.Email &&
                                               x.Subject == "New work item assignee" &&
                                               x.Body == $"You are the new assignee for the work item # {workItemId}"
                                               ));

            await _workItemAuditService.Received(1).WIUpdated(workItemId, Arg.Any <WorkItemHistoryDto>(), Arg.Any <WorkItemHistoryDto>());
        }
Ejemplo n.º 2
0
        public async Task Should_Successfully_Invoke(int workItemId)
        {
            _context.Message.Returns(new WorkItemDeleted {
                WorkItemId = workItemId, OldWorkItem = OldWorkItem
            });

            await _handler.Consume(_context);

            await _workItemAuditService.Received(1).WIDeleted(workItemId, Arg.Is <WorkItemHistoryDto>(value => value == OldWorkItem));
        }
Ejemplo n.º 3
0
        public async Task Should_Successfully_Invoke_Consume_Method(int workItemId, int userId)
        {
            _context.Message.Returns(new WorkItemCreated {
                NewWorkItem = ValidNewWorkItem, WorkItemId = workItemId
            });

            await _handler.Consume(_context);

            await _userService.Received(1).GetById(userId);

            await _bus.Received(1).Publish(Arg.Is <EmailSend>(x =>
                                                              x.Body == $"You are the new assignee for the work item # {workItemId}" &&
                                                              x.To == UserDto.Email &&
                                                              x.Subject == "New work item assignee"));

            await _workItemAuditService.Received(1).WICreated(workItemId, Arg.Is <WorkItemHistoryDto>(value => value == ValidNewWorkItem));
        }