Beispiel #1
0
        public void PetaPocoRepository_Get_Returns_All_Rows(int count)
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(count);

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

            //Act
            IEnumerable <Dog> dogs = repository.Get();

            //Assert
            Assert.AreEqual(count, dogs.Count());
        }
Beispiel #2
0
        public void PetaPocoRepository_Get_Returns_Models_With_Correct_Properties()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dogs = repository.Get();

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

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

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dogs = repository.Get().ToList();

            //Assert
            for (int i = 0; i < dogs.Count(); i++)
            {
                Assert.IsInstanceOf <Dog>(dogs[i]);
            }
        }
        public void PetaPocoRepository_Get_Returns_Models_With_Correct_Properties_Using_FluentMapper()
        {
            // Arrange
            var db     = this.CreatePecaPocoDatabase();
            var mapper = new FluentMapper <Dog>(string.Empty);

            mapper.TableName(Constants.PETAPOCO_DogTableName);
            mapper.Property(d => d.Age, "Age");
            mapper.Property(d => d.Name, "Name");

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            // Act
            var dogs = repository.Get();

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

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

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dogs = repository.Get();

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

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dogs = repository.Get().ToList();

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

            DataUtil.SetUpDatabase(count);

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

            //Act
            IEnumerable<Dog> dogs = repository.Get();

            //Assert
            Assert.AreEqual(count, dogs.Count());
        }