public void GetAccountLink() { moq::Mock <AccountLinkService.AccountLinkServiceClient> mockGrpcClient = new moq::Mock <AccountLinkService.AccountLinkServiceClient>(moq::MockBehavior.Strict); GetAccountLinkRequest request = new GetAccountLinkRequest { ResourceNameAsAccountLinkName = gagvr::AccountLinkName.FromCustomerAccountLink("[CUSTOMER_ID]", "[ACCOUNT_LINK_ID]"), }; gagvr::AccountLink expectedResponse = new gagvr::AccountLink { ResourceNameAsAccountLinkName = gagvr::AccountLinkName.FromCustomerAccountLink("[CUSTOMER_ID]", "[ACCOUNT_LINK_ID]"), Status = gagve::AccountLinkStatusEnum.Types.AccountLinkStatus.Enabled, Type = gagve::LinkedAccountTypeEnum.Types.LinkedAccountType.Unspecified, ThirdPartyAppAnalytics = new gagvr::ThirdPartyAppAnalyticsLinkIdentifier(), DataPartner = new gagvr::DataPartnerLinkIdentifier(), GoogleAds = new gagvr::GoogleAdsLinkIdentifier(), AccountLinkId = 2714466098325457917L, }; mockGrpcClient.Setup(x => x.GetAccountLink(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AccountLinkServiceClient client = new AccountLinkServiceClientImpl(mockGrpcClient.Object, null); gagvr::AccountLink response = client.GetAccountLink(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAccountLinkRequestObjectAsync() { moq::Mock <AccountLinkService.AccountLinkServiceClient> mockGrpcClient = new moq::Mock <AccountLinkService.AccountLinkServiceClient>(moq::MockBehavior.Strict); GetAccountLinkRequest request = new GetAccountLinkRequest { ResourceNameAsAccountLinkName = gagvr::AccountLinkName.FromCustomerAccountLink("[CUSTOMER_ID]", "[ACCOUNT_LINK_ID]"), }; gagvr::AccountLink expectedResponse = new gagvr::AccountLink { ResourceNameAsAccountLinkName = gagvr::AccountLinkName.FromCustomerAccountLink("[CUSTOMER_ID]", "[ACCOUNT_LINK_ID]"), Status = gagve::AccountLinkStatusEnum.Types.AccountLinkStatus.Enabled, Type = gagve::LinkedAccountTypeEnum.Types.LinkedAccountType.Unspecified, ThirdPartyAppAnalytics = new gagvr::ThirdPartyAppAnalyticsLinkIdentifier(), DataPartner = new gagvr::DataPartnerLinkIdentifier(), GoogleAds = new gagvr::GoogleAdsLinkIdentifier(), AccountLinkId = 2714466098325457917L, }; mockGrpcClient.Setup(x => x.GetAccountLinkAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::AccountLink>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AccountLinkServiceClient client = new AccountLinkServiceClientImpl(mockGrpcClient.Object, null); gagvr::AccountLink responseCallSettings = await client.GetAccountLinkAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); gagvr::AccountLink responseCancellationToken = await client.GetAccountLinkAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary> /// Creates an account link. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [DatabaseError]() /// [FieldError]() /// [HeaderError]() /// [InternalError]() /// [MutateError]() /// [QuotaError]() /// [RequestError]() /// [ThirdPartyAppAnalyticsLinkError]() /// </summary> /// <param name="customerId"> /// Required. The ID of the customer for which the account link is created. /// </param> /// <param name="accountLink"> /// Required. The account link to be created. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <CreateAccountLinkResponse> CreateAccountLinkAsync(string customerId, gagvr::AccountLink accountLink, st::CancellationToken cancellationToken) => CreateAccountLinkAsync(customerId, accountLink, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Creates an account link. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [DatabaseError]() /// [FieldError]() /// [HeaderError]() /// [InternalError]() /// [MutateError]() /// [QuotaError]() /// [RequestError]() /// [ThirdPartyAppAnalyticsLinkError]() /// </summary> /// <param name="customerId"> /// Required. The ID of the customer for which the account link is created. /// </param> /// <param name="accountLink"> /// Required. The account link to be created. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <CreateAccountLinkResponse> CreateAccountLinkAsync(string customerId, gagvr::AccountLink accountLink, gaxgrpc::CallSettings callSettings = null) => CreateAccountLinkAsync(new CreateAccountLinkRequest { CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)), AccountLink = gax::GaxPreconditions.CheckNotNull(accountLink, nameof(accountLink)), }, callSettings);