public async Task GetAsyncWithWhereClauseButNoneAsyncMatchSuccessTestAsync() { //Given var repository = new EfCoreAsyncAccountRepository(_databaseFactory); //When var shouldBeNull = await repository.GetAsync(x => false).ConfigureAwait(true); //Then Assert.IsNull(shouldBeNull, "No item should have been found."); }
public async Task GetAsyncWithWhereClauseSuccessTestAsync() { //Given using (var efCoreAsyncUnitOfWork = new EfCoreAsyncUnitOfWork <SharedLibraryContext>(_databaseFactory)) { var repository = new EfCoreAsyncAccountRepository(_databaseFactory); var listOfItems = AccountEntityHelper.CreateEfCoreTestAccounts(3); listOfItems[2].CompanyName = "TestReferenceOtherValue"; await repository.AddRangeAsync(listOfItems).ConfigureAwait(true); await efCoreAsyncUnitOfWork.CommitAsync().ConfigureAwait(true); //When var items = await repository.GetAsync(x => x.CompanyName.Contains("TestReference")).ConfigureAwait(true); //Then EqualityHelper.PropertyValuesAreEqual(items, listOfItems[2], new[] { "AccountID", "LastModified", "LastModifiedBy", "Contacts" }); } }