public void GetSupportedLanguages() { Mock <TranslationService.TranslationServiceClient> mockGrpcClient = new Mock <TranslationService.TranslationServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetSupportedLanguagesRequest expectedRequest = new GetSupportedLanguagesRequest { ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"), DisplayLanguageCode = "displayLanguageCode30710199", Model = "model104069929", }; SupportedLanguages expectedResponse = new SupportedLanguages(); mockGrpcClient.Setup(x => x.GetSupportedLanguages(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); TranslationServiceClient client = new TranslationServiceClientImpl(mockGrpcClient.Object, null); LocationName parent = new LocationName("[PROJECT]", "[LOCATION]"); string displayLanguageCode = "displayLanguageCode30710199"; string model = "model104069929"; SupportedLanguages response = client.GetSupportedLanguages(parent, displayLanguageCode, model); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetSupportedLanguages2() { Mock <TranslationService.TranslationServiceClient> mockGrpcClient = new Mock <TranslationService.TranslationServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetSupportedLanguagesRequest request = new GetSupportedLanguagesRequest { ParentAsLocationName = new LocationName("[PROJECT]", "[LOCATION]"), }; SupportedLanguages expectedResponse = new SupportedLanguages(); mockGrpcClient.Setup(x => x.GetSupportedLanguages(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); TranslationServiceClient client = new TranslationServiceClientImpl(mockGrpcClient.Object, null); SupportedLanguages response = client.GetSupportedLanguages(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }