public void PetaPocoRepository_GetPage_Returns_Page_Of_Rows(int pageIndex, int pageSize)
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(_petaPocoUnitOfWork, mockCache.Object);

            //Act
            var dogs = repository.GetPage(pageIndex, pageSize);

            //Assert
            Assert.AreEqual(pageSize, dogs.PageSize);
        }
Exemple #2
0
        public void PetaPocoRepository_GetPage_Overload_Returns_Page_Of_Rows(int pageIndex, int pageSize)
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(pageIndex, pageSize);

            //Assert
            Assert.AreEqual(pageSize, dogs.PageSize);
        }
        public void PetaPocoRepository_GetPage_Overload_Returns_Correct_Page(int pageIndex, int pageSize, int firstId)
        {
            // Arrange
            var db     = this.CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(string.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(db, mapper);

            // Act
            var dogs = repository.GetPage(pageIndex, pageSize);

            // Assert
            var dog = dogs.First();

            Assert.AreEqual(firstId, dog.ID);
        }
        public void PetaPocoRepository_GetPage_Returns_Models_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(_petaPocoUnitOfWork, 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 PetaPocoRepository_GetPage_Returns_List_Of_Models()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(_petaPocoUnitOfWork, 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]);
            }
        }
Exemple #6
0
        public void PetaPocoRepository_GetPage_Overload_Returns_Models_With_Correct_Properties()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(Constants.PAGE_First, Constants.PAGE_RecordCount);

            //Assert
            var dog = dogs.First();

            Assert.AreEqual(_dogAges[0], dog.Age.ToString());
            Assert.AreEqual(_dogNames[0], dog.Name);
        }
Exemple #7
0
        public void PetaPocoRepository_GetPage_Overload_Returns_List_Of_Models()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository <Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(Constants.PAGE_First, Constants.PAGE_RecordCount);

            //Assert
            for (int i = 0; i < dogs.Count(); i++)
            {
                Assert.IsInstanceOf <Dog>(dogs[i]);
            }
        }
        public void PetaPocoRepository_GetPage_Overload_Returns_Correct_Page(int pageIndex, int pageSize, int firstId)
        {
            //Arrange
            var db = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(pageIndex, pageSize);

            //Assert
            var dog = dogs.First();
            Assert.AreEqual(firstId, dog.ID);
        }
        public void PetaPocoRepository_GetPage_Overload_Returns_Models_With_Correct_Properties()
        {
            //Arrange
            var db = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(Constants.PAGE_First, Constants.PAGE_RecordCount);

            //Assert
            var dog = dogs.First();
            Assert.AreEqual(_dogAges[0], dog.Age.ToString());
            Assert.AreEqual(_dogNames[0], dog.Name);
        }
        public void PetaPocoRepository_GetPage_Overload_Returns_List_Of_Models()
        {
            //Arrange
            var db = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(db, mapper);

            //Act
            var dogs = repository.GetPage(Constants.PAGE_First, Constants.PAGE_RecordCount);

            //Assert
            for (int i = 0; i < dogs.Count(); i++)
            {
                Assert.IsInstanceOf<Dog>(dogs[i]);
            }
        }
        public void PetaPocoRepository_GetPage_Returns_Correct_Page(int pageIndex, int pageSize, int firstId)
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(_petaPocoUnitOfWork, mockCache.Object);

            //Act
            var dogs = repository.GetPage(pageIndex, pageSize);

            //Assert
            var dog = dogs.First();
            Assert.AreEqual(firstId, dog.ID);
        }
        public void PetaPocoRepository_GetPage_Returns_Models_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(_petaPocoUnitOfWork, 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 PetaPocoRepository_GetPage_Returns_List_Of_Models()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(TestConstants.PAGE_TotalCount);

            var repository = new PetaPocoRepository<Dog>(_petaPocoUnitOfWork, 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]);
            }
        }