Esempio n. 1
0
        public async Task should_return_accepted_if_user_is_in_consultation()
        {
            // Arrange
            var cp = new ClaimsPrincipalBuilder().WithRole(AppRoles.RepresentativeRole)
                     .WithUsername("*****@*****.**").Build();

            _sut = SetupControllerWithClaims(cp);

            var request = new InviteToConsultationRequest
            {
                ConferenceId  = _testConference.Id,
                ParticipantId = _testConference.Participants[0].Id,
                RoomLabel     = "Room1"
            };

            // Act
            var result = await _sut.InviteToConsultationAsync(request);

            // Assert
            result.Should().BeOfType <AcceptedResult>();
            _mocker.Mock <IConsultationNotifier>()
            .Verify(
                x => x.NotifyConsultationRequestAsync(_testConference, "Room1", _testConference.Participants[2].Id,
                                                      _testConference.Participants[0].Id), Times.Once);
        }
Esempio n. 2
0
        public async Task should_return_unauthorized_if_user_is_not_in_conference_or_vh_officer()
        {
            // Arrange
            var cp = new ClaimsPrincipalBuilder().WithRole(AppRoles.RepresentativeRole)
                     .WithUsername("*****@*****.**").Build();

            _sut = SetupControllerWithClaims(cp);

            var request = new InviteToConsultationRequest
            {
                ConferenceId  = _testConference.Id,
                ParticipantId = _testConference.Participants[0].Id,
                RoomLabel     = "Room1"
            };

            // Act
            var result = await _sut.InviteToConsultationAsync(request);

            // Assert
            result.Should().BeOfType <UnauthorizedObjectResult>();
        }