public void StartRecording_Returns200Ok(Uri sampleCallBackUri) { ServerCall serverCall = CreateMockServerCall(200, responseContent: DummyStartRecordingResponse); StartCallRecordingResult result = serverCall.StartRecording(sampleCallBackUri); Assert.AreEqual("dummyRecordingId", result.RecordingId); }
public void StartRecordingLatestVersion_Returns200Ok(Uri sampleCallBackUri, RecordingContentType?recordingContentType, RecordingChannelType recordingChannelType, RecordingFormatType recordingFormatType) { ServerCall serverCall = CreateMockServerCall(200, responseContent: DummyStartRecordingResponse); StartCallRecordingResult result = serverCall.StartRecording(sampleCallBackUri, recordingContentType, recordingChannelType, recordingFormatType); Assert.AreEqual("dummyRecordingId", result.RecordingId); }
public async Task RunAllRecordingFunctionsScenarioTests(AuthMethod authMethod) { CallingServerClient callingServerClient = authMethod switch { AuthMethod.ConnectionString => CreateInstrumentedCallingServerClientWithConnectionString(), AuthMethod.TokenCredential => CreateInstrumentedCallingServerClientWithToken(), _ => throw new ArgumentOutOfRangeException(nameof(authMethod)), }; var groupId = GetGroupId(); try { // Establish a Call var callConnections = await CreateGroupCallOperation(callingServerClient, groupId, GetFromUserId(), GetToUserId(), TestEnvironment.AppCallbackUrl).ConfigureAwait(false); var serverCall = callingServerClient.InitializeServerCall(groupId); // Start Recording StartCallRecordingResult startCallRecordingResult = await serverCall.StartRecordingAsync(new Uri(TestEnvironment.AppCallbackUrl)).ConfigureAwait(false); var recordingId = startCallRecordingResult.RecordingId; await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Active).ConfigureAwait(false); // Pause Recording await serverCall.PauseRecordingAsync(recordingId).ConfigureAwait(false); await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Inactive).ConfigureAwait(false); // Resume Recording await serverCall.ResumeRecordingAsync(recordingId).ConfigureAwait(false); await ValidateCallRecordingStateAsync(serverCall, recordingId, CallRecordingState.Active).ConfigureAwait(false); // Stop Recording await serverCall.StopRecordingAsync(recordingId).ConfigureAwait(false); // Get Recording StateAsync Assert.ThrowsAsync <RequestFailedException>(async() => await serverCall.GetRecordingStateAsync(recordingId).ConfigureAwait(false)); // Hang up the Call, there is one call leg in this test case, hangup the call will also delete the call as the result. await SleepIfNotInPlaybackModeAsync().ConfigureAwait(false); await CleanUpConnectionsAsync(callConnections).ConfigureAwait(false); } catch (RequestFailedException ex) { Console.WriteLine(ex.Message); Assert.Fail($"Unexpected error: {ex}"); } catch (Exception ex) { Assert.Fail($"Unexpected error: {ex}"); } }