Esempio n. 1
0
        public void GetUserListRequestObject()
        {
            moq::Mock <UserListService.UserListServiceClient> mockGrpcClient = new moq::Mock <UserListService.UserListServiceClient>(moq::MockBehavior.Strict);
            GetUserListRequest request = new GetUserListRequest
            {
                ResourceNameAsUserListName = gagvr::UserListName.FromCustomerUserList("[CUSTOMER_ID]", "[USER_LIST_ID]"),
            };
            gagvr::UserList expectedResponse = new gagvr::UserList
            {
                ResourceNameAsUserListName = gagvr::UserListName.FromCustomerUserList("[CUSTOMER_ID]", "[USER_LIST_ID]"),
                MembershipStatus           = gagve::UserListMembershipStatusEnum.Types.UserListMembershipStatus.Open,
                SizeRangeForDisplay        = gagve::UserListSizeRangeEnum.Types.UserListSizeRange.Unknown,
                SizeRangeForSearch         = gagve::UserListSizeRangeEnum.Types.UserListSizeRange.OneHundredThousandToThreeHundredThousand,
                Type                  = gagve::UserListTypeEnum.Types.UserListType.CrmBased,
                ClosingReason         = gagve::UserListClosingReasonEnum.Types.UserListClosingReason.Unused,
                AccessReason          = gagve::AccessReasonEnum.Types.AccessReason.Affiliated,
                AccountUserListStatus = gagve::UserListAccessStatusEnum.Types.UserListAccessStatus.Disabled,
                CrmBasedUserList      = new gagvc::CrmBasedUserListInfo(),
                SimilarUserList       = new gagvc::SimilarUserListInfo(),
                RuleBasedUserList     = new gagvc::RuleBasedUserListInfo(),
                LogicalUserList       = new gagvc::LogicalUserListInfo(),
                BasicUserList         = new gagvc::BasicUserListInfo(),
                MatchRatePercentage   = 696939998,
                Id                 = -6774108720365892680L,
                ReadOnly           = false,
                UserListName       = gagvr::UserListName.FromCustomerUserList("[CUSTOMER_ID]", "[USER_LIST_ID]"),
                Description        = "description2cf9da67",
                IntegrationCode    = "integration_codeb56c28f6",
                MembershipLifeSpan = 8593891943371112615L,
                SizeForDisplay     = -3774093290138442712L,
                SizeForSearch      = 7931927642168968409L,
                EligibleForSearch  = false,
                EligibleForDisplay = true,
            };

            mockGrpcClient.Setup(x => x.GetUserList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            UserListServiceClient client   = new UserListServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::UserList       response = client.GetUserList(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetUserList2()
        {
            Mock <UserListService.UserListServiceClient> mockGrpcClient = new Mock <UserListService.UserListServiceClient>(MockBehavior.Strict);
            GetUserListRequest request = new GetUserListRequest
            {
                ResourceName = new UserListName("[CUSTOMER]", "[USER_LIST]").ToString(),
            };
            UserList expectedResponse = new UserList
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetUserList(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            UserListServiceClient client = new UserListServiceClientImpl(mockGrpcClient.Object, null);
            UserList response            = client.GetUserList(request);

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