Пример #1
0
        public async Task GetAdhocMeetingShouldWork()
        {
            // Given
            var input = new AdhocMeetingInput();

            // When
            AdhocMeetingResource meeting = await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false);

            // Then
            Assert.IsNotNull(meeting);
        }
Пример #2
0
        public async Task GetAdhocMeetingShouldThrowOnNullInput()
        {
            // Given
            AdhocMeetingInput input = null;

            // When
            AdhocMeetingResource meeting = await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false);

            // Then
            // Exception is thrown
        }
Пример #3
0
        public async Task GetAdhocMeetingShouldThrowIfServerResponseMalformed()
        {
            // Given
            m_restfulClient.OverrideResponse(new Uri(DataUrls.AdhocMeeting), HttpMethod.Post, HttpStatusCode.OK, "AdhocMeeting_Malformed.json");
            var input = new AdhocMeetingInput();

            // When
            AdhocMeetingResource meeting = await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false);

            // Then
            // Exception is thrown
        }
Пример #4
0
        /// <summary>
        /// Creates an adhoc meeting
        /// </summary>
        /// <param name="loggingContext"><see cref="LoggingContext"/> to be used for logging all related events.</param>
        /// <param name="input">Specifies properties for the meeting to be created</param>
        /// <returns><see cref="IAdhocMeeting"/> which can be used to join the meeting or get meeting url, which can be passed onto real users to join it.</returns>
        public async Task <IAdhocMeeting> CreateAdhocMeetingAsync(AdhocMeetingCreationInput input, LoggingContext loggingContext = null)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            #pragma warning disable CS0618 // Type or member is obsolete
            AdhocMeetingResource adhocMeetingResource = await GetAdhocMeetingResourceAsync(loggingContext, input?.ToPlatformInput()).ConfigureAwait(false);

            #pragma warning restore CS0618 // Type or member is obsolete

            return(new AdhocMeeting(RestfulClient, adhocMeetingResource, BaseUri, UriHelper.CreateAbsoluteUri(BaseUri, adhocMeetingResource.SelfUri), this));
        }
Пример #5
0
        public async Task GetAdhocMeetingShouldThrowIfAdhocMeetingResourceNotAvailable()
        {
            // Given
            m_restfulClient.OverrideResponse(new Uri(DataUrls.Application), HttpMethod.Get, HttpStatusCode.OK, "Application_NoAdhocMeetings.json");
            await m_application.RefreshAsync(m_loggingContext).ConfigureAwait(false);

            var input = new AdhocMeetingInput();

            // When
            AdhocMeetingResource meeting = await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false);

            // Then
            // Exception is thrown
        }
Пример #6
0
        public async Task <AdhocMeetingResource> GetAdhocMeetingResourceAsync(LoggingContext loggingContext, AdhocMeetingInput input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            Logger.Instance.Information("calling Application.RefreshAndInitializeAsync");
            await this.RefreshAsync(loggingContext).ConfigureAwait(false);

            AdhocMeetingResource adhocMeetingResource = null;

            string href = PlatformResource?.OnlineMeetings?.SelfUri;

            if (href == null)
            {
                throw new CapabilityNotAvailableException("Link to create adhoc meeting is not available.");
            }

            Logger.Instance.Information("Start to fetching adhocMeetingResource");
            var url = UriHelper.CreateAbsoluteUri(this.BaseUri, href);

            var httpResponse = await this.PostRelatedPlatformResourceAsync(url, input, new ResourceJsonMediaTypeFormatter(), loggingContext).ConfigureAwait(false);

            try
            {
                var skypeResourceStream = await httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);

                adhocMeetingResource = MediaTypeFormattersHelper.ReadContentWithType(typeof(AdhocMeetingResource), httpResponse.Content.Headers.ContentType, skypeResourceStream) as AdhocMeetingResource;
            }
            catch (Exception ex)
            {
                Logger.Instance.Error("Failed to diserialize anon token ");
                throw new RemotePlatformServiceException("Not get valid AdhocMeetingResource from server, deserialize failure.", ex);
            }

            return(adhocMeetingResource);
        }