public async Task GiveInvalidId_ShouldRaiseNotFound() { var sut = new GetConversationQueryHandler(_context, _mapper); await Should.ThrowAsync <NotFoundException>(() => sut.Handle(new GetConversationQuery { ConversationId = InvalidConversationId.ToString(), LoginUserId = _currentUserServiceMock.Object.UserId }, CancellationToken.None)); }
public async Task GiveValidId_ShouldRaiseConversation() { var sut = new GetConversationQueryHandler(_context, _mapper); var result = await sut.Handle(new GetConversationQuery { ConversationId = conversationId.ToString(), LoginUserId = _currentUserServiceMock.Object.UserId }, CancellationToken.None); result.ShouldBeOfType <ConversationModel>(); result.Id.ShouldBe(conversationId); }
public async Task GiveValidMemberIds_ShouldRaiseConversation() { var sut = new GetConversationQueryHandler(_context, _mapper); List <string> memberList = new List <string>(); memberList.Add(userId1.ToString()); memberList.Add(userId2.ToString()); var result = await sut.Handle(new GetConversationQuery { MembersId = memberList, LoginUserId = _currentUserServiceMock.Object.UserId }, CancellationToken.None); result.ShouldBeOfType <ConversationModel>(); result.Id.ShouldBe(conversationId); result.Type.ShouldBe("pair"); }