public async stt::Task ListPaymentsAccountsRequestObjectAsync() { moq::Mock <PaymentsAccountService.PaymentsAccountServiceClient> mockGrpcClient = new moq::Mock <PaymentsAccountService.PaymentsAccountServiceClient>(moq::MockBehavior.Strict); ListPaymentsAccountsRequest request = new ListPaymentsAccountsRequest { CustomerId = "customer_id3b3724cb", }; ListPaymentsAccountsResponse expectedResponse = new ListPaymentsAccountsResponse { PaymentsAccounts = { new gagvr::PaymentsAccount(), }, }; mockGrpcClient.Setup(x => x.ListPaymentsAccountsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ListPaymentsAccountsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); PaymentsAccountServiceClient client = new PaymentsAccountServiceClientImpl(mockGrpcClient.Object, null); ListPaymentsAccountsResponse responseCallSettings = await client.ListPaymentsAccountsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ListPaymentsAccountsResponse responseCancellationToken = await client.ListPaymentsAccountsAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task ListPaymentsAccountsAsync2() { Mock <PaymentsAccountService.PaymentsAccountServiceClient> mockGrpcClient = new Mock <PaymentsAccountService.PaymentsAccountServiceClient>(MockBehavior.Strict); ListPaymentsAccountsRequest request = new ListPaymentsAccountsRequest { CustomerId = "customerId-1772061412", }; ListPaymentsAccountsResponse expectedResponse = new ListPaymentsAccountsResponse(); mockGrpcClient.Setup(x => x.ListPaymentsAccountsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ListPaymentsAccountsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); PaymentsAccountServiceClient client = new PaymentsAccountServiceClientImpl(mockGrpcClient.Object, null); ListPaymentsAccountsResponse response = await client.ListPaymentsAccountsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }