コード例 #1
0
        public void deleteAccount(AccountBasicInfoRequest account)
        {
            string acctid = _accountsRepository.CreateAccountBasicInfo(account);
            bool   res    = _accountsRepository.DeleteAccount(acctid);

            Assert.True(res);
        }
コード例 #2
0
        public async Task <IActionResult> Update(string action, string id)
        {
            if (action == "delete")
            {
                await _accountRepository.DeleteAccount(id);
            }

            return(LocalRedirect("/admin/accounts"));
        }
コード例 #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));
        }
コード例 #4
0
            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));
            }
コード例 #5
0
        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);
        }
コード例 #6
0
 public IActionResult RemoveAccount([FromRoute] int id)
 {
     return(Ok(_service.DeleteAccount(id)));
 }
コード例 #7
0
 // [UnProtectParams(new string[] {"planid"})]
 public IActionResult DeleteAccount(string accountId)
 {
     return(Ok(_accountsRepository.DeleteAccount(accountId)));
 }
コード例 #8
0
 public void Delete(int id)
 {
     _repository.DeleteAccount(id);
 }