public async Task should_return_video_api_error() { var participant = TestConference.GetJudge(); var user = new ClaimsPrincipalBuilder() .WithUsername(participant.Username) .WithRole(AppRoles.JudgeRole).Build(); Controller = SetupControllerWithClaims(user); var responseMessage = "Could not pause a video hearing"; var apiException = new Services.Video.VideoApiException <ProblemDetails>("Internal Server Error", (int)HttpStatusCode.InternalServerError, responseMessage, null, default, null);
public async Task should_return_video_api_error() { var judge = TestConference.GetJudge(); var witness = TestConference.Participants.First(x => x.HearingRole == "Witness"); var user = new ClaimsPrincipalBuilder() .WithUsername(judge.Username) .WithRole(AppRoles.JudgeRole).Build(); Controller = SetupControllerWithClaims(user); var responseMessage = "Could not start transfer participant"; var apiException = new VideoApiException <ProblemDetails>("Internal Server Error", (int)HttpStatusCode.InternalServerError, responseMessage, null, default, null);
public async Task should_return_unauthorised_if_participant_does_not_exists() { var judge = TestConference.GetJudge(); var user = new ClaimsPrincipalBuilder() .WithUsername(judge.Username) .WithRole(AppRoles.JudgeRole).Build(); Controller = SetupControllerWithClaims(user); var result = await Controller.CallWitnessAsync(TestConference.Id, Guid.NewGuid()); result.Should().BeOfType <UnauthorizedObjectResult>(); var typedResult = (UnauthorizedObjectResult)result; typedResult.Should().NotBeNull(); typedResult.Value.Should().Be("Participant is not a witness"); VideoApiClientMock.Verify( x => x.TransferParticipantAsync(TestConference.Id, It.IsAny <TransferParticipantRequest>()), Times.Never); }
public async Task should_return_unauthorised_if_participant_is_not_a_witness() { var judge = TestConference.GetJudge(); var participant = TestConference.Participants.First(x => x.Role == Role.Individual); var user = new ClaimsPrincipalBuilder() .WithUsername(judge.Username) .WithRole(AppRoles.JudgeRole).Build(); Controller = SetupControllerWithClaims(user); var result = await Controller.DismissWitnessAsync(TestConference.Id, participant.Id); var typedResult = (UnauthorizedObjectResult)result; typedResult.Should().NotBeNull(); typedResult.Value.Should().Be("Participant is not a witness"); VideoApiClientMock.Verify( x => x.TransferParticipantAsync(TestConference.Id, It.Is <TransferParticipantRequest>(r => r.ParticipantId == participant.Id)), Times.Never); }