Exemple #1
0
        public async void FindMakeAsync_Returns_PagedList_Makers()
        {
            var sortMock      = new Mock <ISortingParams>();
            var filterMock    = new Mock <IFilteringParams>();
            var pageMock      = new Mock <IPagingParams>();
            var pagedListMock = new Mock <IPagedList <IVehicleMake> >();

            pagedListMock.Setup(s => s.Count).Returns(10);
            pagedListMock.Setup(s => s.PageNumber).Returns(10);
            pagedListMock.Setup(s => s.PageSize).Returns(10);
            pagedListMock.Setup(s => s.TotalItemCount).Returns(10);


            repoMock.Setup(s => s.FindMakeAsync(It.IsAny <IFilteringParams>(),
                                                It.IsAny <ISortingParams>(),
                                                It.IsAny <IPagingParams>()))
            .Returns(Task.FromResult(pagedListMock.Object));

            uowMock.SetupGet(s => s.Makers).Returns(repoMock.Object);



            var makeService = new VehicleMakeService(uowMock.Object);
            var result      = await makeService.FindMakeAsync(filterMock.Object, sortMock.Object, pageMock.Object);

            //Assert
            Assert.Equal(10, result.TotalItemCount);
            Assert.Equal(10, result.Count);
            Assert.Equal(10, result.PageSize);
            Assert.Equal(10, result.PageNumber);
        }