Example #1
0
        public void Should_Get_Artifacts_When_results_exist()
        {
            _memberDao.CountMembers(Arg.Any <MemberCriteria>()).ReturnsForAnyArgs(50);
            _memberDao.GetMembers(Arg.Any <MemberCriteria>())
            .ReturnsForAnyArgs(_fixture.CreateMany <Member>(50));

            var criteria = new MemberCriteriaModel
            {
                Page     = 1,
                PageSize = 20
            };

            var results = _memberRepo.GetMembers(criteria).Result;

            results.Results.Should().NotBeEmpty();
            results.Results.Count().Should().Be(20);
        }
Example #2
0
        public async Task <MemberResponseModel> GetMembers(MemberCriteriaModel criteriaModel)
        {
            var criteria     = _modelFactory.CreateMemberCriteria(criteriaModel);
            var membersCount = await _memberDao.CountMembers(criteria).ConfigureAwait(false);

            var memberResponse = new MemberResponse
            {
                Links   = CreateLinks(criteria.Page, criteria.PageSize, membersCount),
                Results = await CreateMembers(criteria, membersCount).ConfigureAwait(false)
            };

            return(_modelFactory.CreateMemberResponseModel(memberResponse));
        }