Exemplo n.º 1
0
        public async void Destroy_Should_Return_Status_200()
        {
            var user = await Factory.User();

            await _context.Users.AddAsync(user);

            var account = await Factory.Account(userId : user.Id);

            await _context.Accounts.AddAsync(account);

            var expense = await Factory.Expense(accountId : account.Id);

            await _context.Expenses.AddAsync(expense);

            await _context.SaveChangesAsync();

            _accessor.HttpContext.User = new ClaimsPrincipal
                                         (
                new ClaimsIdentity
                (
                    new Claim[]
            {
                new Claim(ClaimTypes.NameIdentifier, user.Id.ToString())
            }
                )
                                         );

            var result = await _controller.Destroy(account.Id, expense.Id);

            Assert.IsAssignableFrom <OkObjectResult>(result);
        }