public async stt::Task GetKeywordThemeConstantRequestObjectAsync() { moq::Mock <KeywordThemeConstantService.KeywordThemeConstantServiceClient> mockGrpcClient = new moq::Mock <KeywordThemeConstantService.KeywordThemeConstantServiceClient>(moq::MockBehavior.Strict); GetKeywordThemeConstantRequest request = new GetKeywordThemeConstantRequest { ResourceNameAsKeywordThemeConstantName = gagvr::KeywordThemeConstantName.FromExpressCategoryExpressSubCategory("[EXPRESS_CATEGORY_ID]", "[EXPRESS_SUB_CATEGORY_ID]"), }; gagvr::KeywordThemeConstant expectedResponse = new gagvr::KeywordThemeConstant { ResourceNameAsKeywordThemeConstantName = gagvr::KeywordThemeConstantName.FromExpressCategoryExpressSubCategory("[EXPRESS_CATEGORY_ID]", "[EXPRESS_SUB_CATEGORY_ID]"), CountryCode = "country_code8debec55", LanguageCode = "language_code2f6c7160", DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetKeywordThemeConstantAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::KeywordThemeConstant>(stt::Task.FromResult(expectedResponse), null, null, null, null)); KeywordThemeConstantServiceClient client = new KeywordThemeConstantServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordThemeConstant responseCallSettings = await client.GetKeywordThemeConstantAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::KeywordThemeConstant responseCancellationToken = await client.GetKeywordThemeConstantAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetKeywordThemeConstant() { moq::Mock <KeywordThemeConstantService.KeywordThemeConstantServiceClient> mockGrpcClient = new moq::Mock <KeywordThemeConstantService.KeywordThemeConstantServiceClient>(moq::MockBehavior.Strict); GetKeywordThemeConstantRequest request = new GetKeywordThemeConstantRequest { ResourceNameAsKeywordThemeConstantName = gagvr::KeywordThemeConstantName.FromExpressCategoryExpressSubCategory("[EXPRESS_CATEGORY_ID]", "[EXPRESS_SUB_CATEGORY_ID]"), }; gagvr::KeywordThemeConstant expectedResponse = new gagvr::KeywordThemeConstant { ResourceNameAsKeywordThemeConstantName = gagvr::KeywordThemeConstantName.FromExpressCategoryExpressSubCategory("[EXPRESS_CATEGORY_ID]", "[EXPRESS_SUB_CATEGORY_ID]"), CountryCode = "country_code8debec55", LanguageCode = "language_code2f6c7160", DisplayName = "display_name137f65c2", }; mockGrpcClient.Setup(x => x.GetKeywordThemeConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); KeywordThemeConstantServiceClient client = new KeywordThemeConstantServiceClientImpl(mockGrpcClient.Object, null); gagvr::KeywordThemeConstant response = client.GetKeywordThemeConstant(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }