Exemplo n.º 1
0
        public void NPocoRepository_GetById_Returns_Null_If_InValid_Id()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(5);

            var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object);

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

            //Assert
            Assert.IsNull(dog);
        }
Exemplo n.º 2
0
        public void NPocoRepository_GetById_Returns_Model_With_Correct_Properties()
        {
            //Arrange
            var mockCache = new Mock <ICacheProvider>();

            SetUpDatabase(5);

            var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object);

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

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

            var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object);

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

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

            var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object);

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

            //Assert
            Assert.IsNull(dog);
        }