public async Task Should_return_ok() { var conferenceId = _testConference.Id; var participantId = Guid.NewGuid(); var request = new UpdateParticipantDisplayNameRequest { Fullname = "Judge Stive Adams", DisplayName = "Sir Steve", Representee = "" }; _mocker.Mock <IVideoApiClient>() .Setup(x => x.UpdateParticipantDetailsAsync(It.IsAny <Guid>(), It.IsAny <Guid>(), It.Is <UpdateParticipantRequest>(participantRequest => request.Fullname == participantRequest.Fullname && request.DisplayName == participantRequest.DisplayName))) .Returns(Task.FromResult(default(object))); var result = await _sut.UpdateParticipantDisplayNameAsync(conferenceId, participantId, request); var typedResult = (NoContentResult)result; typedResult.Should().NotBeNull(); }
public async Task Should_throw_error_when_get_api_throws_error() { var conferenceId = _testConference.Id; var request = new UpdateParticipantDisplayNameRequest { Fullname = "Judge Stive Adams", DisplayName = "Sir Steve", Representee = "" }; var apiException = new VideoApiException <ProblemDetails>("Bad Request", (int)HttpStatusCode.BadRequest, "Please provide a valid conference Id and participant Id", null, default, null);
public async Task <IActionResult> UpdateParticipantDisplayNameAsync(Guid conferenceId, Guid participantId, [FromBody] UpdateParticipantDisplayNameRequest participantRequest) { try { var apiRequest = _mapperFactory.Get <UpdateParticipantDisplayNameRequest, UpdateParticipantRequest>().Map(participantRequest); await _videoApiClient.UpdateParticipantDetailsAsync(conferenceId, participantId, apiRequest); } catch (VideoApiException ex) { _logger.LogError(ex, "Unable to update participant details for participant: {ParticipantId} in conference: {ConferenceId}", participantId, conferenceId); return(StatusCode(ex.StatusCode, ex.Response)); } return(NoContent()); }