Beispiel #1
0
        public void GetContributionMonetaryReviewerListAdvancedSearch_Success_Test()
        {
            // Arrange
            int?volunteerId = null;

            //int pageIndex = 0;
            int pageSize = 10;

            // list
            IList <R_ContributionMonetaryReviewer> list = new List <R_ContributionMonetaryReviewer>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleContributionMonetaryReviewer(i));
            }

            // create mock for repository
            var mock = new Mock <IContributionMonetaryReviewerRepository>();

            mock.Setup(s => s.GetContributionMonetaryReviewerListAdvancedSearch(
                           Moq.It.IsAny <int?>() // volunteerId
                           )).Returns(list);

            // service
            ContributionMonetaryReviewerService contributionMonetaryReviewerService = new ContributionMonetaryReviewerService();

            ContributionMonetaryReviewerService.Repository = mock.Object;

            // Act
            var resultList = contributionMonetaryReviewerService.GetContributionMonetaryReviewerListAdvancedSearch(
                volunteerId
                );

            ContributionMonetaryReviewerDTO result = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.ContributionMonetaryReviewerId);
        }