Пример #1
0
        public async Task WhenRequesterIsNotChatParticipant_ThrowsForbidden403Exception()
        {
            var user = await RunAsDefaultUserAsync();

            var chat = ArrangeDb.SeedWorkChat(BobJohnes);
            await ArrangeDb.SaveChangesAsync();

            var request = new GetNewParticipantsSelector.Query
            {
                ChatId = chat.Id,
                UserId = user.Id
            };

            await FluentActions.Invoking(async() => await SendAsync(request)).Should().ThrowAsync <Forbidden403Exception>();
        }
Пример #2
0
        public async Task ReturnsUsersThatAreNotParticipantsAlready()
        {
            var user = await RunAsDefaultUserAsync();

            var adele = ArrangeDb.SeedAdeleVance();
            var chat  = ArrangeDb.SeedWorkChat(user, BobJohnes, JohnCena);
            await ArrangeDb.SaveChangesAsync();

            var request = new GetNewParticipantsSelector.Query
            {
                ChatId = chat.Id,
                UserId = user.Id
            };

            var response = await SendAsync(request);

            response.Single().Id.Should().Be(adele.Id);
        }
Пример #3
0
        public async Task <ActionResult <IEnumerable <GetNewParticipantsSelector.UserDto> > > GetNewParticipantsSelector(string id, [FromQuery] GetNewParticipantsSelector.Query request)
        {
            request.ChatId = id;
            request.UserId = CurrentUserService.UserId;
            var response = await Mediator.Send(request);

            return(Ok(response));
        }