public void NPocoRepository_GetPage_Returns_Page_Of_Rows(int pageIndex, int pageSize) { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(pageIndex, pageSize); //Assert Assert.AreEqual(pageSize, dogs.PageSize); }
public void NPocoRepository_GetPage_Returns_Models_With_Correct_Properties() { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(TestConstants.PAGE_First, TestConstants.PAGE_RecordCount); //Assert var dog = dogs.First(); Assert.AreEqual(_dogAges[0], dog.Age.ToString()); Assert.AreEqual(_dogNames[0], dog.Name); }
public void NPocoRepository_GetPage_Returns_List_Of_Models() { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(TestConstants.PAGE_First, TestConstants.PAGE_RecordCount); //Assert for (int i = 0; i < dogs.Count(); i++) { Assert.IsInstanceOf <Dog>(dogs[i]); } }
public void NPocoRepository_GetPage_Returns_Correct_Page(int pageIndex, int pageSize, int firstId) { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(pageIndex, pageSize); //Assert var dog = dogs.First(); Assert.AreEqual(firstId, dog.ID); }
public void NPocoRepository_GetPage_Returns_Models_With_Correct_Properties() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(TestConstants.PAGE_First, TestConstants.PAGE_RecordCount); //Assert var dog = dogs.First(); Assert.AreEqual(_dogAges[0], dog.Age.ToString()); Assert.AreEqual(_dogNames[0], dog.Name); }
public void NPocoRepository_GetPage_Returns_List_Of_Models() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(TestConstants.PAGE_TotalCount); var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetPage(TestConstants.PAGE_First, TestConstants.PAGE_RecordCount); //Assert for (int i = 0; i < dogs.Count(); i++) { Assert.IsInstanceOf<Dog>(dogs[i]); } }