public void deleteAccount(AccountBasicInfoRequest account)
        {
            string acctid = _accountsRepository.CreateAccountBasicInfo(account);
            bool   res    = _accountsRepository.DeleteAccount(acctid);

            Assert.True(res);
        }
        public async Task <IActionResult> Update(string action, string id)
        {
            if (action == "delete")
            {
                await _accountRepository.DeleteAccount(id);
            }

            return(LocalRedirect("/admin/accounts"));
        }
Example #3
0
        public async Task ShouldNotToDeleteAccountAsync()
        {
            // Arrange
            using var factory         = new SQLiteDbContextFactory();
            await using var dbContext = factory.CreateContext();
            _service = new Service.Service.AccountsService(dbContext, _mapper);
            int accountId = 9;

            //Act
            var response = _service.DeleteAccount(accountId);

            // Assert
            Assert.IsFalse(response);
            Assert.AreEqual(8, dbContext.Accounts.Count());
            Assert.IsNull(dbContext.Accounts.Find(accountId));
        }
            public async Task ShouldBeAbleToDeleteAccountAsync()
            {
                // Arrange
                using var factory         = new SQLiteDbContextFactory();
                await using var dbContext = factory.CreateContext();
                _accountService           = new BankApplication.Service.Service.AccountsService(dbContext, _mapper);
                int accountId = 1;

                //Act
                var response = _accountService.DeleteAccount(accountId);

                // Assert
                Assert.IsTrue(response);
                Assert.AreEqual(4, dbContext.Accounts.Count());
                Assert.IsNull(dbContext.Accounts.Find(accountId));
            }
        public async Task DeleteAccount_ShouldNotWork()
        {
            using var factory         = new SQLiteDbContextFactory();
            await using var dbContext = factory.CreateContext();
            accountsRepository        = new AccountsService(dbContext, mapper);

            //Arrange
            var accountId     = 92;
            var expectedCount = await dbContext.Accounts.CountAsync();

            //Actual
            var actual      = accountsRepository.DeleteAccount(accountId);
            var actualCount = await dbContext.Accounts.CountAsync();

            //Assert
            Assert.False(actual);
            Assert.Equal(expectedCount, actualCount);
        }
 public IActionResult RemoveAccount([FromRoute] int id)
 {
     return(Ok(_service.DeleteAccount(id)));
 }
Example #7
0
 // [UnProtectParams(new string[] {"planid"})]
 public IActionResult DeleteAccount(string accountId)
 {
     return(Ok(_accountsRepository.DeleteAccount(accountId)));
 }
 public void Delete(int id)
 {
     _repository.DeleteAccount(id);
 }