public async Task Should_return_ok_when_user_is_in_conference() { var conference = CreateValidConferenceResponse(); conference.Participants[0].UserRole = UserRole.Individual; _mocker.Mock <IVideoApiClient>() .Setup(x => x.GetConferenceDetailsByIdAsync(It.IsAny <Guid>())) .ReturnsAsync(conference); var result = await _controller.GetConferenceByIdAsync(conference.Id); var typedResult = (OkObjectResult)result.Result; typedResult.Should().NotBeNull(); var judge = conference.Participants.SingleOrDefault(p => p.UserRole == UserRole.Judge); _mocker.Mock <IConferenceCache>().Verify(x => x.AddConferenceAsync(new ConferenceDetailsResponse()), Times.Never); var response = (ConferenceResponse)typedResult.Value; response.CaseNumber.Should().Be(conference.CaseNumber); response.Participants[0].Role.Should().Be(UserRole.Individual); response.Participants.Any(x => x.Role == Role.Individual).Should().BeTrue(); response.Participants.Any(x => x.Role == Role.Representative).Should().BeTrue(); response.Participants.Any(x => x.Role == Role.Judge).Should().BeTrue(); response.Participants.SingleOrDefault(x => x.Role == Role.Judge).TiledDisplayName.Should().Be($"T{0};{judge.DisplayName};{judge.Id}"); response.Participants.Any(x => x.Role == Role.JudicialOfficeHolder).Should().BeTrue(); }
public async Task Should_return_ok_when_user_is_in_conference() { var conference = CreateValidConferenceResponse(); conference.Participants[0].User_role = UserRole.Individual; _videoApiClientMock .Setup(x => x.GetConferenceDetailsByIdAsync(It.IsAny <Guid>())) .ReturnsAsync(conference); var result = await _controller.GetConferenceByIdAsync(conference.Id); var typedResult = (OkObjectResult)result.Result; typedResult.Should().NotBeNull(); _mockConferenceCache.Verify(x => x.AddConferenceAsync(new ConferenceDetailsResponse()), Times.Never); var response = (ConferenceResponse)typedResult.Value; response.CaseNumber.Should().Be(conference.Case_number); response.Participants[0].Role.Should().Be(UserRole.Individual); }