public void DeletePayment() { var context = serviceProvider.GetRequiredService <DataContext>(); var controller = new PaymentsController(context); context.Payment.Add(payment1); context.SaveChanges(); controller.DeletePayment(1); var card = controller.GetPaymentById(1).Result.Value; Assert.Null(card); }