コード例 #1
0
        public void EFLinqRepository_Find_Returns_Instance_Of_Model_If_Valid_Property()
        {
            //Arrange
            SetUpDatabase(5);
            var dogName = _dogNames[2];

            var repository = new EFLinqRepository <Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dog = repository.Find((d) => d.Name == dogName).FirstOrDefault();

            //Assert
            Assert.IsInstanceOf <Dog>(dog);
        }
コード例 #2
0
        public void EFLinqRepository_Find_Returns_List_Of_Models_If_Valid_Property(string dogName, int count)
        {
            //Arrange
            SetUpDatabase(5);

            var repository = new EFLinqRepository <Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            Assert.IsInstanceOf <IEnumerable <Dog> >(dogs);
            Assert.AreEqual(count, dogs.Count());
        }
コード例 #3
0
        public void EFLinqRepository_Find_Returns_Empty_List_If_InValid_Proeprty()
        {
            //Arrange
            SetUpDatabase(5);
            const string dogName = "Invalid";

            var repository = new EFLinqRepository <Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            Assert.IsInstanceOf <IEnumerable <Dog> >(dogs);
            Assert.AreEqual(0, dogs.Count());
        }
コード例 #4
0
        public void EFLinqRepository_Find_Returns_Models_With_Correct_Properties(string dogName)
        {
            //Arrange
            SetUpDatabase(5);

            var repository = new EFLinqRepository <Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            foreach (Dog dog in dogs)
            {
                Assert.AreEqual(dogName, dog.Name);
            }
        }
コード例 #5
0
        public void EFLinqRepository_Find_Returns_Models_With_Correct_Properties(string dogName)
        {
            //Arrange
            SetUpDatabase(5);

            var repository = new EFLinqRepository<Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            foreach (Dog dog in dogs)
            {
                Assert.AreEqual(dogName, dog.Name);
            }
        }
コード例 #6
0
        public void EFLinqRepository_Find_Returns_Empty_List_If_InValid_Proeprty()
        {
            //Arrange
            SetUpDatabase(5);
            const string dogName = "Invalid";

            var repository = new EFLinqRepository<Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            Assert.IsInstanceOf<IEnumerable<Dog>>(dogs);
            Assert.AreEqual(0, dogs.Count());
        }
コード例 #7
0
        public void EFLinqRepository_Find_Returns_Instance_Of_Model_If_Valid_Property()
        {
            //Arrange
            SetUpDatabase(5);
            var dogName = _dogNames[2];

            var repository = new EFLinqRepository<Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dog = repository.Find((d) => d.Name == dogName).FirstOrDefault();

            //Assert
            Assert.IsInstanceOf<Dog>(dog);
        }
コード例 #8
0
        public void EFLinqRepository_Find_Returns_List_Of_Models_If_Valid_Property(string dogName, int count)
        {
            //Arrange
            SetUpDatabase(5);

            var repository = new EFLinqRepository<Dog>(_efUnitOfWork, _cache.Object);

            //Act
            var dogs = repository.Find((d) => d.Name == dogName);

            //Assert
            Assert.IsInstanceOf<IEnumerable<Dog>>(dogs);
            Assert.AreEqual(count, dogs.Count());
        }