Exemple #1
0
        public void GetUserInterest()
        {
            moq::Mock <UserInterestService.UserInterestServiceClient> mockGrpcClient = new moq::Mock <UserInterestService.UserInterestServiceClient>(moq::MockBehavior.Strict);
            GetUserInterestRequest request = new GetUserInterestRequest
            {
                ResourceNameAsUserInterestName = gagvr::UserInterestName.FromCustomerUserInterest("[CUSTOMER]", "[USER_INTEREST]"),
            };
            gagvr::UserInterest expectedResponse = new gagvr::UserInterest
            {
                ResourceNameAsUserInterestName = gagvr::UserInterestName.FromCustomerUserInterest("[CUSTOMER]", "[USER_INTEREST]"),
                TaxonomyType     = gagve::UserInterestTaxonomyTypeEnum.Types.UserInterestTaxonomyType.Unknown,
                UserInterestId   = 3507346946980618534L,
                UserInterestName = gagvr::UserInterestName.FromCustomerUserInterest("[CUSTOMER]", "[USER_INTEREST]"),
                UserInterestParentAsUserInterestName = gagvr::UserInterestName.FromCustomerUserInterest("[CUSTOMER]", "[USER_INTEREST]"),
                LaunchedToAll  = true,
                Availabilities =
                {
                    new gagvc::CriterionCategoryAvailability(),
                },
            };

            mockGrpcClient.Setup(x => x.GetUserInterest(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            UserInterestServiceClient client   = new UserInterestServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::UserInterest       response = client.GetUserInterest(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void GetUserInterest2()
        {
            Mock <UserInterestService.UserInterestServiceClient> mockGrpcClient = new Mock <UserInterestService.UserInterestServiceClient>(MockBehavior.Strict);
            GetUserInterestRequest request = new GetUserInterestRequest
            {
                ResourceName = new UserInterestName("[CUSTOMER]", "[USER_INTEREST]").ToString(),
            };
            UserInterest expectedResponse = new UserInterest
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetUserInterest(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            UserInterestServiceClient client = new UserInterestServiceClientImpl(mockGrpcClient.Object, null);
            UserInterest response            = client.GetUserInterest(request);

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