public void NPocoRepository_GetByProperty_Returns_Instance_Of_Model_If_Valid_Property() { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(5); var dogName = _dogNames[2]; var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dog = repository.GetByProperty("Name", dogName).FirstOrDefault(); //Assert Assert.IsInstanceOf <Dog>(dog); }
public void NPocoRepository_GetByProperty_Returns_List_Of_Models_If_Valid_Property(string dogName, int count) { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(5); var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert Assert.IsInstanceOf <IEnumerable <Dog> >(dogs); Assert.AreEqual(count, dogs.Count()); }
public void NPocoRepository_GetByProperty_Returns_Empty_List_If_InValid_Proeprty() { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(5); const string dogName = "Invalid"; var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert Assert.IsInstanceOf <IEnumerable <Dog> >(dogs); Assert.AreEqual(0, dogs.Count()); }
public void NPocoRepository_GetByProperty_Returns_Models_With_Correct_Properties(string dogName) { //Arrange var mockCache = new Mock <ICacheProvider>(); SetUpDatabase(5); var repository = new NPocoRepository <Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert foreach (Dog dog in dogs) { Assert.AreEqual(dogName, dog.Name); } }
public void NPocoRepository_GetByProperty_Returns_Models_With_Correct_Properties(string dogName) { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert foreach (Dog dog in dogs) { Assert.AreEqual(dogName, dog.Name); } }
public void NPocoRepository_GetByProperty_Returns_Empty_List_If_InValid_Proeprty() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); const string dogName = "Invalid"; var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert Assert.IsInstanceOf<IEnumerable<Dog>>(dogs); Assert.AreEqual(0, dogs.Count()); }
public void NPocoRepository_GetByProperty_Returns_Instance_Of_Model_If_Valid_Property() { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); var dogName = _dogNames[2]; var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dog = repository.GetByProperty("Name", dogName).FirstOrDefault(); //Assert Assert.IsInstanceOf<Dog>(dog); }
public void NPocoRepository_GetByProperty_Returns_List_Of_Models_If_Valid_Property(string dogName, int count) { //Arrange var mockCache = new Mock<ICacheProvider>(); SetUpDatabase(5); var repository = new NPocoRepository<Dog>(_nPocoUnitOfWork, mockCache.Object); //Act var dogs = repository.GetByProperty("Name", dogName); //Assert Assert.IsInstanceOf<IEnumerable<Dog>>(dogs); Assert.AreEqual(count, dogs.Count()); }