public async Task GetAdhocMeetingShouldWorkWithNullLoggingContext() { // Given var input = new AdhocMeetingInput(); // When await m_application.GetAdhocMeetingResourceAsync(null, input).ConfigureAwait(false); // Then // No exception is thrown }
public async Task CreateAdhocMeetingShouldWork() { // Given var input = new AdhocMeetingInput(); // When AdhocMeetingResource meeting = await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false); // Then Assert.IsNotNull(meeting); }
public async Task GetAdhocMeetingShouldThrowOnNullInput() { // Given AdhocMeetingInput input = null; // When await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false); // Then // Exception is thrown }
public MeetingOutput ScheduleAdhocMeeting(MeetingInput input) { AdhocMeetingInput adhocMeetingInput = input.ToAdhocMeetingInput(); if (!_isInitialized) { InitializeEndpoint(); } var adhocMeeting = _applicationEndpoint.Application.GetAdhocMeetingResourceAsync(_loggingContext, adhocMeetingInput).Result; return(adhocMeeting.ToMeetingOutput()); }
public async Task GetAdhocMeetingShouldThrowIfServerResponseMalformed() { // Given m_restfulClient.OverrideResponse(new Uri(DataUrls.AdhocMeeting), HttpMethod.Post, HttpStatusCode.OK, "AdhocMeeting_Malformed.json"); var input = new AdhocMeetingInput(); // When await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false); // Then // Exception is thrown }
public async Task GetAdhocMeetingShouldMakeHttpRequest() { // Given var input = new AdhocMeetingInput(); Assert.IsFalse(m_restfulClient.RequestsProcessed("POST " + DataUrls.AdhocMeeting)); // When await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false); // Then Assert.IsTrue(m_restfulClient.RequestsProcessed("POST " + DataUrls.AdhocMeeting), "HTTP request to create adhoc meeting wasn't sent out."); }
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 await m_application.GetAdhocMeetingResourceAsync(m_loggingContext, input).ConfigureAwait(false); // Then // Exception is thrown }
public override async Task <T> ExecuteCoreWithResultAsync <T>() { AdhocMeetingToken result = null; LoggingContext loggingContext = new LoggingContext(this.JobId, this.InstanceId); Logger.Instance.Information(string.Format("[GetAdhoc meeting job] stared: LoggingContext: {0}", loggingContext.JobId)); try { GetAdhocMeetingResourceInput getAnonTokenInput = this.JobInput as GetAdhocMeetingResourceInput; if (getAnonTokenInput == null) { throw new InvalidOperationException("Failed to get valid AdhocMeetingInput intance"); } AdhocMeetingInput adhocinput = new AdhocMeetingInput() { AccessLevel = AccessLevel.Everyone, EntryExitAnnouncement = EntryExitAnnouncement.Disabled, AutomaticLeaderAssignment = AutomaticLeaderAssignment.Disabled, Subject = getAnonTokenInput.Subject, LobbyBypassForPhoneUsers = LobbyBypassForPhoneUsers.Disabled, PhoneUserAdmission = PhoneUserAdmission.Disabled, Description = getAnonTokenInput.Description }; var adhocmeetingResources = await AzureApplication.ApplicationEndpoint.Application.GetAdhocMeetingResourceAsync(loggingContext, adhocinput); if (adhocmeetingResources != null) { result = new AdhocMeetingToken { DiscoverUri = adhocmeetingResources.DiscoverLink.Href, ExpireTime = adhocmeetingResources.ExpirationTime, JoinUrl = adhocmeetingResources.JoinUrl, OnlineMeetingUri = adhocmeetingResources.OnlineMeetingUri, OrganizerUri = adhocmeetingResources.OrganizerUri }; } } catch (Exception ex) { throw new Exception("Failed to get anon token and discover url " + ex.Message); } return(result as T); }
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); }