public async Task StartAdhocMeetingShouldReturnATaskToWaitForInvitationStartedEvent() { // Given IAudioVideoInvitation invitation = null; m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => invitation = args.NewInvite; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall.json"); var invitationOperationid = string.Empty; m_restfulClient.HandleRequestProcessed += (sender, args) => { string operationId = TestHelper.RaiseEventsOnHttpRequest(args, DataUrls.StartAdhocMeeting, HttpMethod.Post, null, null); if (!string.IsNullOrEmpty(operationId)) { invitationOperationid = operationId; } }; Task invitationTask = invitation.StartAdhocMeetingAsync("Test subject", "https://example.com/callback", m_loggingContext); await Task.Delay(TimeSpan.FromMilliseconds(200)).ConfigureAwait(false); Assert.IsFalse(invitationTask.IsCompleted); // When TestHelper.RaiseEventsFromFileWithOperationId(m_mockEventChannel, "Event_OnlineMeetingInvitationStarted.json", invitationOperationid); // Then Assert.IsTrue(invitationTask.IsCompleted); }
public async Task StartAdhocMeetingShouldWorkWithNullLoggingContext() { // Given IAudioVideoInvitation invitation = null; m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => invitation = args.NewInvite; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall.json"); m_restfulClient.HandleRequestProcessed += (sender, args) => TestHelper.RaiseEventsOnHttpRequest(args, DataUrls.StartAdhocMeeting, HttpMethod.Post, "Event_OnlineMeetingInvitationStarted.json", m_mockEventChannel); // When await invitation.StartAdhocMeetingAsync("Test subject", "mycallbackContext", null).ConfigureAwait(false); // Then // No exception is thrown }
public async Task StartAdhocMeetingShouldThrowIfAdhocMeetingStartedEventNotReceived() { // Given IAudioVideoInvitation invitation = null; m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => invitation = args.NewInvite; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall.json"); ((AudioVideoInvitation)invitation).WaitForEvents = TimeSpan.FromMilliseconds(300); // When await invitation.StartAdhocMeetingAsync("Test subject", "myCallbackContext", m_loggingContext).ConfigureAwait(false); // Then // Exception is thrown }
public async Task StartAdhocMeetingShouldMakeTheHttpRequest() { // Given IAudioVideoInvitation invitation = null; m_applicationEndpoint.HandleIncomingAudioVideoCall += (sender, args) => { invitation = args.NewInvite; }; TestHelper.RaiseEventsFromFile(m_mockEventChannel, "Event_IncomingAudioCall.json"); m_restfulClient.HandleRequestProcessed += (sender, args) => { TestHelper.RaiseEventsOnHttpRequest(args, DataUrls.StartAdhocMeeting, HttpMethod.Post, "Event_OnlineMeetingInvitationStarted.json", m_mockEventChannel); }; // When await invitation.StartAdhocMeetingAsync("Test subject", "myCallbackContext", m_loggingContext).ConfigureAwait(false); // Then Assert.IsTrue(m_restfulClient.RequestsProcessed("POST " + DataUrls.StartAdhocMeeting)); }