예제 #1
0
        public async void All()
        {
            var mock    = new ServiceMockFacade <IUsersRepository>();
            var records = new List <Users>();

            records.Add(new Users());
            mock.RepositoryMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult(records));
            var service = new UsersService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.UsersModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLUsersMapperMock,
                                           mock.DALMapperMockFactory.DALUsersMapperMock);

            List <ApiUsersResponseModel> response = await service.All();

            response.Should().HaveCount(1);
            mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>()));
        }
예제 #2
0
 public JsonResult List()
 {
     return(Json(db.All(), JsonRequestBehavior.AllowGet));
 }