public void ExecuteStoredProcedureAsActionWithBrokenSyntaxTestAsync() { //Given var repository = new EfCoreAsyncAccountRepository(_databaseFactory); //When AsyncTestDelegate testDelegate = async() => await repository.ExecuteQueryAsActionAsync("exec DeleteAsyncAllAccountsFake").ConfigureAwait(true); //Then Assert.ThrowsAsync <SqlException>(testDelegate); }
public async Task ExecuteStoredProcedureAsActionTestAsync() { //Given using (var efCoreAsyncUnitOfWork = new EfCoreAsyncUnitOfWork <SharedLibraryContext>(_databaseFactory)) { var repository = new EfCoreAsyncAccountRepository(_databaseFactory); var listOfItems = AccountEntityHelper.CreateEfCoreTestAccounts(3); await repository.AddRangeAsync(listOfItems).ConfigureAwait(true); await efCoreAsyncUnitOfWork.CommitAsync().ConfigureAwait(true); //When await repository.ExecuteQueryAsActionAsync("exec DeleteAllAccounts").ConfigureAwait(true); //Then var allItems = await repository.GetAllAsync().ConfigureAwait(true); Assert.AreEqual(0, allItems.ToList().Count(), "There are still items in the database."); } }