public void DeleteAccount_ExistingAccount_AccountIsNotPresentInTheDB() { // Arrange var accountModel = new AccountModel { Badges = new List <AccountBadgeModel>(), Costs = new List <CostInfoModel>(), Name = "ExpenseManagerAccount01" }; using (var dbContext = new ExpenseDbContext(Effort.DbConnectionFactory.CreatePersistent(TestInstaller.ExpenseManagerTestDbConnection))) { dbContext.Accounts.Add(accountModel); dbContext.SaveChanges(); } var accountId = accountModel.Id; // Act _accountFacade.DeleteAccount(accountId); // Assert bool accountExistsInDb; using (var dbContext = new ExpenseDbContext(Effort.DbConnectionFactory.CreatePersistent(TestInstaller.ExpenseManagerTestDbConnection))) { accountExistsInDb = dbContext.Users.Find(accountId) != null; } Assert.That(!accountExistsInDb, "Account was not removed."); }
public async Task DeleteAccount(int identityUser, string accountId, bool result) { var runStatementResult = await accountFacade.DeleteAccount(identityUser, accountId); Assert.Equal(runStatementResult.IsError(), result); }