private async Task Updating_A_Comment_Sets_LastUpdatedBy_On_BacklogItem() { // GIVEN a backlog item created by Homer Simpson var(homerId, margeId) = await SeedTwoUsers(); _currentUserId = homerId; var ticketId = (await CreateBacklogItem()).Id !; // and a comment from Marge _currentUserId = margeId; var commentId = (await _commentCommandService.Create(ticketId, new CommentAddUpdRequest { Message = "Marge's comment" })).Value.CommentId !; // and another comment from Homer _currentUserId = homerId; await _commentCommandService.Create(ticketId, new CommentAddUpdRequest { Message = "Homer's comment" }); await SaveChanges(); var item0 = (await _queryByIdService.GetById(ticketId)).Value; Assert.Equal(homerId, item0.LastUpdated.ActionedBy.Id); // WHEN Marge updates her comment _currentUserId = margeId; await _commentCommandService.Update(ticketId, commentId, new CommentAddUpdRequest { Message = "Updated Marge's comment" }); await SaveChanges(); // THEN var item = (await _queryByIdService.GetById(ticketId)).Value; // its 'Created By' remains unchanged Assert.Equal(homerId, item.Created.ActionedBy.Id); // its 'Modified By' points to Marge Simpson Assert.Equal(margeId, item.LastUpdated.ActionedBy.Id); }
public Task <ActionResult <BacklogItemCommentReference> > Create([FromServices] IBacklogItemCommentCommandService service, [FromRoute] string backlogItemId, BacklogItemCommentAddUpdateRequest @params) => service.Create(backlogItemId, @params.Message).ToActionResultOfT();
public Task <ActionResult <BacklogItemCommentReference> > Create([FromServices] IBacklogItemCommentCommandService service, [FromRoute] string backlogItemId, [FromQuery] CommentAddUpdRequest dto) => service.Create(backlogItemId, dto).ToActionResultOfT();