public IActionResult PutAccount([FromRoute] Guid guid, [FromBody] Domain.Models.AccountModels.Account account)
        {
            if (guid != account.AccountId)
            {
                return(BadRequest());
            }

            return(Ok(accountService.Upsert(account, User)));
        }
Exemplo n.º 2
0
        public Domain.Models.AccountModels.Account CreateTestAccount(string accountName = TestAccountName)
        {
            var newAccount = new Domain.Models.AccountModels.Account {
                AccountName = accountName
            };

            AccountService.Insert(newAccount);
            newAccount = AccountService.Search(accountName).First();
            return(newAccount);
        }
        public void CreateNewAccountWithUpsertTest()
        {
            var newAccount = new Domain.Models.AccountModels.Account {
                AccountName = "New Upsert Test Account"
            };

            AccountService.Upsert(newAccount, TestUserPrincipal);
            var foundAccounts = AccountService.Search("New Upsert Test Account").ToList();

            Assert.AreEqual(1, foundAccounts.Count);
            Assert.AreEqual(foundAccounts.First().AccountName, newAccount.AccountName);

            AccountService.DeleteByGuid(foundAccounts.First().AccountId);
        }
        public void InsertAccountWithNameThatIsSoftDeletedTest()
        {
            TestAccount.IsDeleted = true;
            AccountService.Update(TestAccount);

            var newAccount = new Domain.Models.AccountModels.Account {
                AccountName = TestAccountName
            };

            AccountService.Upsert(newAccount, TestUserPrincipal);

            var foundAccounts = AccountService.Search(TestAccountName).ToList();

            Assert.AreEqual(1, foundAccounts.Count);
            Assert.AreEqual <string>(foundAccounts.First().AccountName, TestAccount.AccountName);
            Assert.IsFalse(foundAccounts.First().IsDeleted);
        }
 public IActionResult PostAccount([FromBody] Domain.Models.AccountModels.Account account)
 {
     return(Ok(accountService.Upsert(account, User)));
 }
Exemplo n.º 6
0
 public void DeleteTestAccount(Domain.Models.AccountModels.Account account)
 {
     AccountService.DeleteByGuid(account.AccountId);
 }