public void GetAutocompleteItemsButNoneExist() { //Given var databseFactory = new EfCoreDatabaseFactoryBase <SharedLibraryContext>("SharedLibraryContext"); var repository = new EfCoreAccountRepository(databseFactory); //When var shouldBeEmpty = repository.GetAutoCompleteItems(x => false, 1); //Then Assert.IsFalse(shouldBeEmpty.Any(), "No item should have been found."); }
public void GetAutoCompleteItemsTest() { //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 item = repository.GetAutoCompleteItems(x => x.CompanyName.Contains(reference), 1); //Then EqualityHelper.PropertyValuesAreEqual(item.First(), listOfItems[0], new[] { "AccountID", "LastModified", "LastModifiedBy", "Contacts" }); } }