Exemple #1
0
        public async stt::Task GetCustomInterestRequestObjectAsync()
        {
            moq::Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new moq::Mock <CustomInterestService.CustomInterestServiceClient>(moq::MockBehavior.Strict);
            GetCustomInterestRequest request = new GetCustomInterestRequest
            {
                ResourceNameAsCustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
            };
            gagvr::CustomInterest expectedResponse = new gagvr::CustomInterest
            {
                ResourceNameAsCustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
                Id                 = -6774108720365892680L,
                Status             = gagve::CustomInterestStatusEnum.Types.CustomInterestStatus.Enabled,
                CustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
                Type               = gagve::CustomInterestTypeEnum.Types.CustomInterestType.CustomIntent,
                Description        = "description2cf9da67",
                Members            =
                {
                    new gagvr::CustomInterestMember(),
                },
            };

            mockGrpcClient.Setup(x => x.GetCustomInterestAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::CustomInterest>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomInterest       responseCallSettings = await client.GetCustomInterestAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::CustomInterest responseCancellationToken = await client.GetCustomInterestAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void GetCustomInterestRequestObject()
        {
            moq::Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new moq::Mock <CustomInterestService.CustomInterestServiceClient>(moq::MockBehavior.Strict);
            GetCustomInterestRequest request = new GetCustomInterestRequest
            {
                ResourceNameAsCustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
            };
            gagvr::CustomInterest expectedResponse = new gagvr::CustomInterest
            {
                ResourceNameAsCustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
                Id                 = -6774108720365892680L,
                Status             = gagve::CustomInterestStatusEnum.Types.CustomInterestStatus.Enabled,
                CustomInterestName = gagvr::CustomInterestName.FromCustomerCustomInterest("[CUSTOMER]", "[CUSTOM_INTEREST]"),
                Type               = gagve::CustomInterestTypeEnum.Types.CustomInterestType.CustomIntent,
                Description        = "description2cf9da67",
                Members            =
                {
                    new gagvr::CustomInterestMember(),
                },
            };

            mockGrpcClient.Setup(x => x.GetCustomInterest(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomInterestServiceClient client   = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CustomInterest       response = client.GetCustomInterest(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public async stt::Task MutateCustomInterestsAsync()
        {
            moq::Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new moq::Mock <CustomInterestService.CustomInterestServiceClient>(moq::MockBehavior.Strict);
            MutateCustomInterestsRequest request = new MutateCustomInterestsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomInterestOperation(),
                },
            };
            MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse
            {
                Results =
                {
                    new MutateCustomInterestResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateCustomInterestsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateCustomInterestsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CustomInterestServiceClient   client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomInterestsResponse responseCallSettings = await client.MutateCustomInterestsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            MutateCustomInterestsResponse responseCancellationToken = await client.MutateCustomInterestsAsync(request.CustomerId, request.Operations, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #4
0
        public void MutateCustomInterests()
        {
            moq::Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new moq::Mock <CustomInterestService.CustomInterestServiceClient>(moq::MockBehavior.Strict);
            MutateCustomInterestsRequest request = new MutateCustomInterestsRequest
            {
                CustomerId = "customer_id3b3724cb",
                Operations =
                {
                    new CustomInterestOperation(),
                },
            };
            MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse
            {
                Results =
                {
                    new MutateCustomInterestResult(),
                },
            };

            mockGrpcClient.Setup(x => x.MutateCustomInterests(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CustomInterestServiceClient   client   = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomInterestsResponse response = client.MutateCustomInterests(request.CustomerId, request.Operations);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #5
0
        public async Task MutateCustomInterestsAsync3()
        {
            Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict);
            MutateCustomInterestsRequest request = new MutateCustomInterestsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomInterestsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <MutateCustomInterestsResponse>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomInterestServiceClient   client   = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomInterestsResponse response = await client.MutateCustomInterestsAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #6
0
        public void MutateCustomInterests3()
        {
            Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict);
            MutateCustomInterestsRequest request = new MutateCustomInterestsRequest
            {
                CustomerId = "customerId-1772061412",
                Operations = { },
            };
            MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomInterests(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomInterestServiceClient   client   = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            MutateCustomInterestsResponse response = client.MutateCustomInterests(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #7
0
        public void GetCustomInterest2()
        {
            Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict);
            GetCustomInterestRequest request = new GetCustomInterestRequest
            {
                ResourceName = new CustomInterestName("[CUSTOMER]", "[CUSTOM_INTEREST]").ToString(),
            };
            CustomInterest expectedResponse = new CustomInterest
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomInterest(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            CustomInterest response            = client.GetCustomInterest(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #8
0
        public async Task GetCustomInterestAsync2()
        {
            Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict);
            GetCustomInterestRequest request = new GetCustomInterestRequest
            {
                ResourceName = new CustomInterestName("[CUSTOMER]", "[CUSTOM_INTEREST]").ToString(),
            };
            CustomInterest expectedResponse = new CustomInterest
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomInterestAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomInterest>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            CustomInterest response            = await client.GetCustomInterestAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #9
0
        public void MutateCustomInterests()
        {
            Mock <CustomInterestService.CustomInterestServiceClient> mockGrpcClient = new Mock <CustomInterestService.CustomInterestServiceClient>(MockBehavior.Strict);
            MutateCustomInterestsRequest expectedRequest = new MutateCustomInterestsRequest
            {
                CustomerId   = "customerId-1772061412",
                Operations   = { },
                ValidateOnly = false,
            };
            MutateCustomInterestsResponse expectedResponse = new MutateCustomInterestsResponse();

            mockGrpcClient.Setup(x => x.MutateCustomInterests(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomInterestServiceClient client = new CustomInterestServiceClientImpl(mockGrpcClient.Object, null);
            string customerId = "customerId-1772061412";
            IEnumerable <CustomInterestOperation> operations = new List <CustomInterestOperation>();
            bool validateOnly = false;
            MutateCustomInterestsResponse response = client.MutateCustomInterests(customerId, operations, validateOnly);

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