Esempio n. 1
0
        public async stt::Task GetCustomerNegativeCriterionRequestObjectAsync()
        {
            moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new moq::Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(moq::MockBehavior.Strict);
            GetCustomerNegativeCriterionRequest request = new GetCustomerNegativeCriterionRequest
            {
                ResourceNameAsCustomerNegativeCriterionName = gagvr::CustomerNegativeCriterionName.FromCustomerCustomerNegativeCriterion("[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERION]"),
            };
            gagvr::CustomerNegativeCriterion expectedResponse = new gagvr::CustomerNegativeCriterion
            {
                ResourceNameAsCustomerNegativeCriterionName = gagvr::CustomerNegativeCriterionName.FromCustomerCustomerNegativeCriterion("[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERION]"),
                Id                = -6774108720365892680L,
                Type              = gagve::CriterionTypeEnum.Types.CriterionType.Location,
                ContentLabel      = new gagvc::ContentLabelInfo(),
                MobileApplication = new gagvc::MobileApplicationInfo(),
                MobileAppCategory = new gagvc::MobileAppCategoryInfo(),
                Placement         = new gagvc::PlacementInfo(),
                YoutubeVideo      = new gagvc::YouTubeVideoInfo(),
                YoutubeChannel    = new gagvc::YouTubeChannelInfo(),
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCustomerNegativeCriterionAsync2()
        {
            Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient> mockGrpcClient = new Mock <CustomerNegativeCriterionService.CustomerNegativeCriterionServiceClient>(MockBehavior.Strict);
            GetCustomerNegativeCriterionRequest request = new GetCustomerNegativeCriterionRequest
            {
                ResourceName = new CustomerNegativeCriteriaName("[CUSTOMER]", "[CUSTOMER_NEGATIVE_CRITERIA]").ToString(),
            };
            CustomerNegativeCriterion expectedResponse = new CustomerNegativeCriterion
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerNegativeCriterionAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomerNegativeCriterion>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerNegativeCriterionServiceClient client = new CustomerNegativeCriterionServiceClientImpl(mockGrpcClient.Object, null);
            CustomerNegativeCriterion response            = await client.GetCustomerNegativeCriterionAsync(request);

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