Skip to content

Commit

Permalink
Change sourcelocale to string, with culture info validation (Azure#34586
Browse files Browse the repository at this point in the history
)

* Change sourcelocale to string, with culture info validation

* remove unnessary validation
  • Loading branch information
wangrui-msft authored Feb 27, 2023
1 parent 847e79a commit f6d847c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,8 @@ public StartRecordingOptions(Azure.Communication.CallAutomation.CallLocator call
public partial class TextSource : Azure.Communication.CallAutomation.PlaySource
{
public TextSource(string text) { }
public TextSource(string text, System.Globalization.CultureInfo sourceLocale, Azure.Communication.CallAutomation.GenderType gender) { }
public TextSource(string text, string voiceName) { }
public TextSource(string text, string sourceLocale, Azure.Communication.CallAutomation.GenderType gender) { }
public string SourceLocale { get { throw null; } set { } }
public string Text { get { throw null; } }
public Azure.Communication.CallAutomation.GenderType? VoiceGender { get { throw null; } set { } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public TextSource(string text, string voiceName)

/// <summary> Initializes a new instance of TextSource. </summary>
/// <param name="text"> Text for the cognitive service to be played. </param>
/// <param name="sourceLocale"> The culture info of the voice. </param>
/// <param name="sourceLocale"> The culture info string of the voice. </param>
/// <param name="gender"> The gender of the voice. </param>
/// <exception cref="ArgumentNullException"> <paramref name="text"/> is null. </exception>
public TextSource(string text, CultureInfo sourceLocale, GenderType gender)
public TextSource(string text, string sourceLocale, GenderType gender)
{
Argument.AssertNotNull(text, nameof(text));

Text = text;
SourceLocale = sourceLocale.Name;
SourceLocale = sourceLocale;
VoiceGender = gender;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class CallMediaTests : CallAutomationTestBase
OperationContext = "operationContext",
Prompt = new FileSource(new Uri("https://localhost"))
};

private static CallMediaRecognizeOptions _choiceRecognizeOptions = new CallMediaRecognizeChoiceOptions(new CommunicationUserIdentifier("targetUserId"), s_recognizeChoices)
{
InterruptCallMediaOperation = true,
Expand Down Expand Up @@ -142,6 +143,7 @@ public void RecognizeOperations_Return202Accepted(Func<CallMedia, Response<Start
Assert.AreEqual((int)HttpStatusCode.Accepted, result.GetRawResponse().Status);
}
}

[TestCaseSource(nameof(TestData_PlayOperationsAsync))]
public void PlayOperationsAsync_Return404NotFound(Func<CallMedia, Task<Response<PlayResult>>> operation)
{
Expand Down

0 comments on commit f6d847c

Please sign in to comment.