예제 #1
0
        public void UpdateBankAccount()
        {
            var context = serviceProvider.GetRequiredService <DataContext>();

            var controller = new BankAccountsController(context);

            context.BankAccount.Add(bankAccount1);
            context.SaveChanges();

            //The entity is not being tracked by the context
            context.Entry(bankAccount1).State = EntityState.Detached;

            BankAccount bankAccount3 = new BankAccount
            {
                Id          = "18379133",
                BankName    = "First Bank",
                Balance     = 33.98,
                AccountType = "BUSINESS",
                UserId      = 2
            };

            var updateResult = controller.PutBankAccount(Int32.Parse(bankAccount3.Id), bankAccount3).Result;


            Assert.IsType <OkResult>(updateResult);
        }