Ejemplo n.º 1
0
 public async stt::Task MutateMerchantCenterLinkAsync()
 {
     moq::Mock<MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new moq::Mock<MerchantCenterLinkService.MerchantCenterLinkServiceClient>(moq::MockBehavior.Strict);
     MutateMerchantCenterLinkRequest request = new MutateMerchantCenterLinkRequest
     {
         CustomerId = "customer_id3b3724cb",
         Operation = new MerchantCenterLinkOperation(),
     };
     MutateMerchantCenterLinkResponse expectedResponse = new MutateMerchantCenterLinkResponse
     {
         Result = new MutateMerchantCenterLinkResult(),
     };
     mockGrpcClient.Setup(x => x.MutateMerchantCenterLinkAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<MutateMerchantCenterLinkResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
     MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null);
     MutateMerchantCenterLinkResponse responseCallSettings = await client.MutateMerchantCenterLinkAsync(request.CustomerId, request.Operation, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
     Assert.AreEqual(expectedResponse, responseCallSettings);
     MutateMerchantCenterLinkResponse responseCancellationToken = await client.MutateMerchantCenterLinkAsync(request.CustomerId, request.Operation, st::CancellationToken.None);
     Assert.AreEqual(expectedResponse, responseCancellationToken);
     mockGrpcClient.VerifyAll();
 }
Ejemplo n.º 2
0
        public async Task MutateMerchantCenterLinkAsync2()
        {
            Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(MockBehavior.Strict);
            MutateMerchantCenterLinkRequest request = new MutateMerchantCenterLinkRequest
            {
                CustomerId = "customerId-1772061412",
                Operation  = new MerchantCenterLinkOperation(),
            };
            MutateMerchantCenterLinkResponse expectedResponse = new MutateMerchantCenterLinkResponse();

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

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