コード例 #1
0
 public async Task should_return_badrequest_on_exception()
 {
     // Arrange
     var request = new LockConsultationRoomRequest
     {
         ConferenceId = _testConference.Id,
         RoomLabel    = "Room",
         Lock         = false
     };
     var apiException = new VideoApiException <ProblemDetails>("Bad Request", (int)HttpStatusCode.BadRequest,
                                                               "Please provide a valid conference Id", null, default, null);
コード例 #2
0
        public async Task should_return_no_content_when_lock_state_changed()
        {
            // Arrange
            var request = new LockConsultationRoomRequest
            {
                ConferenceId = _testConference.Id,
                RoomLabel    = "Room",
                Lock         = false
            };

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

            // Assert
            result.Should().BeOfType <NoContentResult>();
            _mocker.Mock <IVideoApiClient>().Verify(x => x.LockRoomAsync(It.IsAny <LockRoomRequest>()), Times.Once);
        }
コード例 #3
0
        public async Task <IActionResult> LockConsultationRoomRequestAsync(LockConsultationRoomRequest request)
        {
            try
            {
                var conference = await GetConference(request.ConferenceId);

                var lockRequestMapper = _mapperFactory.Get <LockConsultationRoomRequest, LockRoomRequest>();
                var mappedRequest     = lockRequestMapper.Map(request);
                await _videoApiClient.LockRoomAsync(mappedRequest);

                await _consultationNotifier.NotifyRoomUpdateAsync(conference,
                                                                  new Room { Label = request.RoomLabel, Locked = request.Lock, ConferenceId = conference.Id });

                return(NoContent());
            }
            catch (VideoApiException e)
            {
                _logger.LogError(e, "Could not update the lock state of the consultation room");
                return(StatusCode(e.StatusCode, e.Response));
            }
        }