Ejemplo n.º 1
0
        public async Task Should_return_participant_not_found_when_request_is_sent()
        {
            // Arrange
            var conference = new Conference {
                Id = Guid.NewGuid()
            };

            _mocker.Mock <IConferenceCache>().Setup(cache =>
                                                    cache.GetOrAddConferenceAsync(conference.Id, It.IsAny <Func <Task <ConferenceDetailsResponse> > >()))
            .Callback(async(Guid anyGuid, Func <Task <ConferenceDetailsResponse> > factory) => await factory())
            .ReturnsAsync(conference);
            var leaveConsultationRequest = Builder <LeavePrivateConsultationRequest> .CreateNew()
                                           .With(x => x.ConferenceId = conference.Id).Build();

            // Act
            var result = await _sut.LeaveConsultationAsync(leaveConsultationRequest);

            // Assert
            result.Should().BeOfType <NotFoundResult>();
        }
Ejemplo n.º 2
0
        public async Task Should_return_participant_not_found_when_request_is_sent()
        {
            _mocker.Mock <IVideoApiClient>()
            .Setup(x => x.LeaveConsultationAsync(It.IsAny <LeaveConsultationRequest>()))
            .Returns(Task.FromResult(default(object)));
            var conference = new Conference {
                Id = Guid.NewGuid()
            };

            _mocker.Mock <IConferenceCache>().Setup(cache =>
                                                    cache.GetOrAddConferenceAsync(conference.Id, It.IsAny <Func <Task <ConferenceDetailsResponse> > >()))
            .Callback(async(Guid anyGuid, Func <Task <ConferenceDetailsResponse> > factory) => await factory())
            .ReturnsAsync(conference);

            var endConsultationRequest = Builder <LeavePrivateConsultationRequest> .CreateNew()
                                         .With(x => x.ConferenceId = conference.Id).Build();

            var result = await _sut.LeaveConsultationAsync(endConsultationRequest);

            var typedResult = (NotFoundResult)result;

            typedResult.Should().NotBeNull();
        }