예제 #1
0
        public void GetContributionMonetaryReviewersPaged_Success_Test()
        {
            // Arrange
            string searchTerm = "";
            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.GetContributionMonetaryReviewers(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list);

            // service
            ContributionMonetaryReviewerService contributionMonetaryReviewerService = new ContributionMonetaryReviewerService();

            ContributionMonetaryReviewerService.Repository = mock.Object;

            // Act
            var resultList = contributionMonetaryReviewerService.GetContributionMonetaryReviewers(searchTerm, pageIndex, pageSize);
            ContributionMonetaryReviewerDTO result = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.ContributionMonetaryReviewerId);
            Assert.AreEqual(10, resultList.Count);
        }
예제 #2
0
        public void GetContributionMonetaryReviewers_Success_Test()
        {
            // Arrange
            R_ContributionMonetaryReviewer contributionMonetaryReviewer = SampleContributionMonetaryReviewer(1);

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

            list.Add(contributionMonetaryReviewer);

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

            mock.Setup(s => s.GetContributionMonetaryReviewers()).Returns(list);

            // service
            ContributionMonetaryReviewerService contributionMonetaryReviewerService = new ContributionMonetaryReviewerService();

            ContributionMonetaryReviewerService.Repository = mock.Object;

            // Act
            var resultList = contributionMonetaryReviewerService.GetContributionMonetaryReviewers();
            ContributionMonetaryReviewerDTO result = resultList.FirstOrDefault();

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