public async stt::Task GetProductBiddingCategoryConstantRequestObjectAsync() { moq::Mock <ProductBiddingCategoryConstantService.ProductBiddingCategoryConstantServiceClient> mockGrpcClient = new moq::Mock <ProductBiddingCategoryConstantService.ProductBiddingCategoryConstantServiceClient>(moq::MockBehavior.Strict); GetProductBiddingCategoryConstantRequest request = new GetProductBiddingCategoryConstantRequest { ResourceNameAsProductBiddingCategoryConstantName = gagvr::ProductBiddingCategoryConstantName.FromCountryCodeLevelId("[COUNTRY_CODE]", "[LEVEL]", "[ID]"), }; gagvr::ProductBiddingCategoryConstant expectedResponse = new gagvr::ProductBiddingCategoryConstant { ResourceNameAsProductBiddingCategoryConstantName = gagvr::ProductBiddingCategoryConstantName.FromCountryCodeLevelId("[COUNTRY_CODE]", "[LEVEL]", "[ID]"), Level = gagve::ProductBiddingCategoryLevelEnum.Types.ProductBiddingCategoryLevel.Unknown, Status = gagve::ProductBiddingCategoryStatusEnum.Types.ProductBiddingCategoryStatus.Active, Id = -6774108720365892680L, CountryCode = "country_code8debec55", ProductBiddingCategoryConstantParentAsProductBiddingCategoryConstantName = gagvr::ProductBiddingCategoryConstantName.FromCountryCodeLevelId("[COUNTRY_CODE]", "[LEVEL]", "[ID]"), LanguageCode = "language_code2f6c7160", LocalizedName = "localized_namefc402dfa", }; mockGrpcClient.Setup(x => x.GetProductBiddingCategoryConstantAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::ProductBiddingCategoryConstant>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ProductBiddingCategoryConstantServiceClient client = new ProductBiddingCategoryConstantServiceClientImpl(mockGrpcClient.Object, null); gagvr::ProductBiddingCategoryConstant responseCallSettings = await client.GetProductBiddingCategoryConstantAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::ProductBiddingCategoryConstant responseCancellationToken = await client.GetProductBiddingCategoryConstantAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task GetProductBiddingCategoryConstantAsync2() { Mock <ProductBiddingCategoryConstantService.ProductBiddingCategoryConstantServiceClient> mockGrpcClient = new Mock <ProductBiddingCategoryConstantService.ProductBiddingCategoryConstantServiceClient>(MockBehavior.Strict); GetProductBiddingCategoryConstantRequest request = new GetProductBiddingCategoryConstantRequest { ResourceName = new ProductBiddingCategoryConstantName("[PRODUCT_BIDDING_CATEGORY_CONSTANT]").ToString(), }; ProductBiddingCategoryConstant expectedResponse = new ProductBiddingCategoryConstant { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetProductBiddingCategoryConstantAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ProductBiddingCategoryConstant>(Task.FromResult(expectedResponse), null, null, null, null)); ProductBiddingCategoryConstantServiceClient client = new ProductBiddingCategoryConstantServiceClientImpl(mockGrpcClient.Object, null); ProductBiddingCategoryConstant response = await client.GetProductBiddingCategoryConstantAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }