public void ListVoices2() { Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new Mock <TextToSpeech.TextToSpeechClient>(MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest(); ListVoicesResponse expectedResponse = new ListVoicesResponse(); mockGrpcClient.Setup(x => x.ListVoices(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse response = client.ListVoices(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ListVoices() { Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new Mock <TextToSpeech.TextToSpeechClient>(MockBehavior.Strict); ListVoicesRequest expectedRequest = new ListVoicesRequest { LanguageCode = "languageCode-412800396", }; ListVoicesResponse expectedResponse = new ListVoicesResponse(); mockGrpcClient.Setup(x => x.ListVoices(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); string languageCode = "languageCode-412800396"; ListVoicesResponse response = client.ListVoices(languageCode); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ListVoices() { moq::Mock <TextToSpeech.TextToSpeechClient> mockGrpcClient = new moq::Mock <TextToSpeech.TextToSpeechClient>(moq::MockBehavior.Strict); ListVoicesRequest request = new ListVoicesRequest { LanguageCode = "language_code2f6c7160", }; ListVoicesResponse expectedResponse = new ListVoicesResponse { Voices = { new Voice(), }, }; mockGrpcClient.Setup(x => x.ListVoices(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TextToSpeechClient client = new TextToSpeechClientImpl(mockGrpcClient.Object, null); ListVoicesResponse response = client.ListVoices(request.LanguageCode); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }