Ejemplo n.º 1
0
        public ConferenceState Poll()
        {
            if (_api == null || _conferenceId == Guid.Empty)
            {
                throw new DataMisalignedException("Video api or conference Id must be set");
            }

            var actualState = ConferenceState.NotStarted;

            for (var i = 0; i < _maxRetries; i++)
            {
                var response   = _api.GetConferenceByConferenceId(_conferenceId);
                var conference = RequestHelper.Deserialise <ConferenceDetailsResponse>(response.Content);
                if (conference != null)
                {
                    actualState = conference.Current_status;
                    if (actualState.Equals(_expectedState))
                    {
                        return(conference.Current_status);
                    }
                }
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }
            throw new DataMisalignedException($"Expected hearing state to be updated to {_expectedState} but was {actualState}");
        }
Ejemplo n.º 2
0
        private static Guid GetTheHearingIdFromTheConference(TestApiManager api, Guid conferenceId)
        {
            var response = api.GetConferenceByConferenceId(conferenceId);

            if (!response.IsSuccessful)
            {
                return(Guid.Empty);
            }
            var conference = RequestHelper.Deserialise <ConferenceDetailsResponse>(response.Content);

            return(conference.HearingId);
        }
        public ParticipantState Poll()
        {
            var actualState = ParticipantState.None;

            for (var i = 0; i < _maxRetries; i++)
            {
                var response   = _api.GetConferenceByConferenceId(_conferenceId);
                var conference = RequestHelper.Deserialise <ConferenceDetailsResponse>(response.Content);
                conference.Should().NotBeNull();
                var participant = conference.Participants.Find(x => x.Username.ToLower().Equals(_username.ToLower()));
                actualState = participant.Current_status;
                if (actualState.Equals(_expectedState))
                {
                    return(actualState);
                }
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }
            throw new DataMisalignedException($"Expected participant state to be updated to {_expectedState} but was {actualState}");
        }
Ejemplo n.º 4
0
        private static bool ConferenceHasNotBeenDeletedAlready(TestApiManager api, Guid conferenceId)
        {
            var response = api.GetConferenceByConferenceId(conferenceId);

            return(!response.StatusCode.Equals(HttpStatusCode.NotFound));
        }