public void GetManyWithWhereClauseButNoneMatchSuccessTest() { //Given var databseFactory = new EfCoreDatabaseFactoryBase <SharedLibraryContext>("SharedLibraryContext"); var repository = new EfCoreAccountRepository(databseFactory); //When var shouldBeEmpty = repository.GetMany(x => false); //Then Assert.IsFalse(shouldBeEmpty.Any(), "No item should have been found."); }
public void GetManyWithWhereClauseSuccessTest() { //Given var databseFactory = new EfCoreDatabaseFactoryBase <SharedLibraryContext>("SharedLibraryContext"); using (var efCoreUnitOfWork = new EfCoreUnitOfWork <SharedLibraryContext>(databseFactory)) { var repository = new EfCoreAccountRepository(databseFactory); var reference = "TestReference"; var listOfItems = GetItemsWithTwoItemsContainingTestReference(reference); repository.AddRange(listOfItems); efCoreUnitOfWork.Commit(); //When var items = repository.GetMany(x => x.CompanyName.Contains(reference)); //Then EqualityHelper.AssertListsAreEqual(items.OrderBy(x => x.CompanyName).ToList(), listOfItems.OrderBy(x => x.CompanyName).Take(2).ToList(), new[] { "AccountID", "LastModified", "LastModifiedBy", "Contacts" }); } }