public async stt::Task MoveManagerLinkRequestObjectAsync() { moq::Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient> mockGrpcClient = new moq::Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient>(moq::MockBehavior.Strict); MoveManagerLinkRequest request = new MoveManagerLinkRequest { CustomerId = "customer_id3b3724cb", PreviousCustomerManagerLink = "previous_customer_manager_linkb33a0aa8", NewManager = "new_managerbf35b8c4", ValidateOnly = true, }; MoveManagerLinkResponse expectedResponse = new MoveManagerLinkResponse { ResourceNameAsCustomerManagerLinkName = gagvr::CustomerManagerLinkName.FromCustomerManagerCustomerManagerLink("[CUSTOMER_ID]", "[MANAGER_CUSTOMER_ID]", "[MANAGER_LINK_ID]"), }; mockGrpcClient.Setup(x => x.MoveManagerLinkAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MoveManagerLinkResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CustomerManagerLinkServiceClient client = new CustomerManagerLinkServiceClientImpl(mockGrpcClient.Object, null); MoveManagerLinkResponse responseCallSettings = await client.MoveManagerLinkAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MoveManagerLinkResponse responseCancellationToken = await client.MoveManagerLinkAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task MoveManagerLinkAsync() { Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient> mockGrpcClient = new Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient>(MockBehavior.Strict); MoveManagerLinkRequest expectedRequest = new MoveManagerLinkRequest { CustomerId = "customerId-1772061412", PreviousCustomerManagerLink = "previousCustomerManagerLink-1454597947", NewManager = "newManager90619918", }; MoveManagerLinkResponse expectedResponse = new MoveManagerLinkResponse { ResourceName = "resourceName979421212", }; mockGrpcClient.Setup(x => x.MoveManagerLinkAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MoveManagerLinkResponse>(Task.FromResult(expectedResponse), null, null, null, null)); CustomerManagerLinkServiceClient client = new CustomerManagerLinkServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; string previousCustomerManagerLink = "previousCustomerManagerLink-1454597947"; string newManager = "newManager90619918"; MoveManagerLinkResponse response = await client.MoveManagerLinkAsync(customerId, previousCustomerManagerLink, newManager); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MoveManagerLinkAsync() { moq::Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient> mockGrpcClient = new moq::Mock <CustomerManagerLinkService.CustomerManagerLinkServiceClient>(moq::MockBehavior.Strict); MoveManagerLinkRequest request = new MoveManagerLinkRequest { CustomerId = "customer_id3b3724cb", PreviousCustomerManagerLink = "previous_customer_manager_linkb33a0aa8", NewManager = "new_managerbf35b8c4", }; MoveManagerLinkResponse expectedResponse = new MoveManagerLinkResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.MoveManagerLinkAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MoveManagerLinkResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CustomerManagerLinkServiceClient client = new CustomerManagerLinkServiceClientImpl(mockGrpcClient.Object, null); MoveManagerLinkResponse responseCallSettings = await client.MoveManagerLinkAsync(request.CustomerId, request.PreviousCustomerManagerLink, request.NewManager, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MoveManagerLinkResponse responseCancellationToken = await client.MoveManagerLinkAsync(request.CustomerId, request.PreviousCustomerManagerLink, request.NewManager, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }