Exemplo n.º 1
0
        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.");
        }
Exemplo n.º 2
0
        public async Task DeleteAccount(int identityUser, string accountId, bool result)
        {
            var runStatementResult = await accountFacade.DeleteAccount(identityUser, accountId);

            Assert.Equal(runStatementResult.IsError(), result);
        }