public void PetaPocoRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(5);

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

            //Act
            var dog = repository.GetById(TestConstants.PETAPOCO_InvalidDogId);

            //Assert
            Assert.IsNull(dog);
        }
Beispiel #2
0
        public void PetaPocoRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dog = repository.GetById(Constants.PETAPOCO_InvalidDogId);

            //Assert
            Assert.IsNull(dog);
        }
        public void PetaPocoRepository_GetById_Returns_Model_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(5);

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

            //Act
            var dog = repository.GetById(TestConstants.PETAPOCO_ValidDogId);

            //Assert
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogAge, dog.Age);
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogName, dog.Name);
        }
Beispiel #4
0
        public void PetaPocoRepository_GetById_Returns_Model_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 dog = repository.GetById(Constants.PETAPOCO_ValidDogId);

            //Assert
            Assert.AreEqual(Constants.PETAPOCO_ValidDogAge, dog.Age);
            Assert.AreEqual(Constants.PETAPOCO_ValidDogName, dog.Name);
        }
Beispiel #5
0
        public void PetaPocoRepository_GetById_Returns_Null_If_InValid_Id_Using_FluentMapper()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new FluentMapper <Dog>(String.Empty);

            mapper.TableName(Constants.PETAPOCO_DogTableName);
            mapper.PrimaryKey("ID");
            mapper.Property(d => d.ID, "ID");
            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 dog = repository.GetById(Constants.PETAPOCO_InvalidDogId);

            //Assert
            Assert.IsNull(dog);
        }
Beispiel #6
0
        public void PetaPocoRepository_GetById_Returns_Model_With_Correct_Properties_Using_FluentMapper()
        {
            //Arrange
            var db     = CreatePecaPocoDatabase();
            var mapper = new FluentMapper <Dog>(String.Empty);

            mapper.TableName(Constants.PETAPOCO_DogTableName);
            mapper.PrimaryKey("ID");
            mapper.Property(d => d.ID, "ID");
            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 dog = repository.GetById(Constants.PETAPOCO_ValidDogId);

            //Assert
            Assert.AreEqual(Constants.PETAPOCO_ValidDogAge, dog.Age);
            Assert.AreEqual(Constants.PETAPOCO_ValidDogName, dog.Name);
        }
        public void PetaPocoRepository_GetById_Returns_Model_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 dog = repository.GetById(Constants.PETAPOCO_ValidDogId);

            //Assert
            Assert.AreEqual(Constants.PETAPOCO_ValidDogAge, dog.Age);
            Assert.AreEqual(Constants.PETAPOCO_ValidDogName, dog.Name);
        }
        public void PetaPocoRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var db = CreatePecaPocoDatabase();
            var mapper = new PetaPocoMapper(String.Empty);

            DataUtil.SetUpDatabase(Constants.PETAPOCO_RecordCount);

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

            //Act
            var dog = repository.GetById(Constants.PETAPOCO_InvalidDogId);

            //Assert
            Assert.IsNull(dog);
        }
        public void PetaPocoRepository_GetById_Returns_Model_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(5);

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

            //Act
            var dog = repository.GetById(TestConstants.PETAPOCO_ValidDogId);

            //Assert
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogAge, dog.Age);
            Assert.AreEqual(TestConstants.PETAPOCO_ValidDogName, dog.Name);
        }
        public void PetaPocoRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(5);

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

            //Act
            var dog = repository.GetById(TestConstants.PETAPOCO_InvalidDogId);

            //Assert
            Assert.IsNull(dog);
        }
Beispiel #11
0
        public void PetaPocoRepository_GetById_Returns_Instance_Of_Model_If_Valid_Id()
        {
            //Arrange
            var mockCache = new Mock<ICacheProvider>();
            SetUpDatabase(5);

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

            //Act
            var dog = repository.GetById(TestConstants.PETAPOCO_ValidDogId);

            //Assert
            Assert.IsInstanceOf<Dog>(dog);
        }