public void GetMerchantCenterLinkResourceNames() { moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new moq::Mock <MerchantCenterLinkService.MerchantCenterLinkServiceClient>(moq::MockBehavior.Strict); GetMerchantCenterLinkRequest request = new GetMerchantCenterLinkRequest { ResourceNameAsMerchantCenterLinkName = gagvr::MerchantCenterLinkName.FromCustomerMerchantCenterLink("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"), }; gagvr::MerchantCenterLink expectedResponse = new gagvr::MerchantCenterLink { ResourceNameAsMerchantCenterLinkName = gagvr::MerchantCenterLinkName.FromCustomerMerchantCenterLink("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"), Status = gagve::MerchantCenterLinkStatusEnum.Types.MerchantCenterLinkStatus.Enabled, Id = -6774108720365892680L, MerchantCenterAccountName = "merchant_center_account_name94680907", }; mockGrpcClient.Setup(x => x.GetMerchantCenterLink(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null); gagvr::MerchantCenterLink response = client.GetMerchantCenterLink(request.ResourceNameAsMerchantCenterLinkName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
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(); }
public void ListMerchantCenterLinks() { 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.ListMerchantCenterLinks(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null); ListMerchantCenterLinksResponse response = client.ListMerchantCenterLinks(request.CustomerId); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetMerchantCenterLinkResourceNamesAsync() { moq::Mock<MerchantCenterLinkService.MerchantCenterLinkServiceClient> mockGrpcClient = new moq::Mock<MerchantCenterLinkService.MerchantCenterLinkServiceClient>(moq::MockBehavior.Strict); GetMerchantCenterLinkRequest request = new GetMerchantCenterLinkRequest { ResourceNameAsMerchantCenterLinkName = gagvr::MerchantCenterLinkName.FromCustomerMerchantCenterLink("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"), }; gagvr::MerchantCenterLink expectedResponse = new gagvr::MerchantCenterLink { ResourceNameAsMerchantCenterLinkName = gagvr::MerchantCenterLinkName.FromCustomerMerchantCenterLink("[CUSTOMER]", "[MERCHANT_CENTER_LINK]"), Status = gagve::MerchantCenterLinkStatusEnum.Types.MerchantCenterLinkStatus.Enabled, Id = -6774108720365892680L, MerchantCenterAccountName = "merchant_center_account_name94680907", }; mockGrpcClient.Setup(x => x.GetMerchantCenterLinkAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<gagvr::MerchantCenterLink>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MerchantCenterLinkServiceClient client = new MerchantCenterLinkServiceClientImpl(mockGrpcClient.Object, null); gagvr::MerchantCenterLink responseCallSettings = await client.GetMerchantCenterLinkAsync(request.ResourceNameAsMerchantCenterLinkName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::MerchantCenterLink responseCancellationToken = await client.GetMerchantCenterLinkAsync(request.ResourceNameAsMerchantCenterLinkName, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
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)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateMerchantCenterLinkResponse responseCancellationToken = await client.MutateMerchantCenterLinkAsync(request.CustomerId, request.Operation, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }