public async stt::Task ListMerchantCenterLinksRequestObjectAsync()
        {
            moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(moq::MockBehavior.Strict);
            ListMerchantCenterLinksRequest request = new ListMerchantCenterLinksRequest
            {
                CustomerId = "customer_id3b3724cb",
            };
            ListMerchantCenterLinksResponse expectedResponse = new ListMerchantCenterLinksResponse
            {
                MerchantCenterLinks =
                {
                    new gagvr::MerchantCenterLink(),
                },
            };

            mockGrpcClient.Setup(x => x.ListMerchantCenterLinksAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListMerchantCenterLinksResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
            ListMerchantCenterLinksResponse responseCallSettings = await client.ListMerchantCenterLinksAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            ListMerchantCenterLinksResponse responseCancellationToken = await client.ListMerchantCenterLinksAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public async Task ListMerchantCenterLinksAsync2()
        {
            Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(MockBehavior.Strict);
            ListMerchantCenterLinksRequest request = new ListMerchantCenterLinksRequest
            {
                CustomerId = "customerId-1772061412",
            };
            ListMerchantCenterLinksResponse expectedResponse = new ListMerchantCenterLinksResponse();

            mockGrpcClient.Setup(x => x.ListMerchantCenterLinksAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ListMerchantCenterLinksResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            MerchantCenterLinkServiceClient client   = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
            ListMerchantCenterLinksResponse response = await client.ListMerchantCenterLinksAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }