public void RemoveTicketCallsRepositoryDeleteTicketWithTheSameTicketNumber()
        {
            _repository = Substitute.For <ITicketRepository>();
            _mgr        = new TicketManager(_repository);

            _mgr.RemoveTicket(5);
            _repository.Received(1).DeleteTicket(5);
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try {
                mgr.RemoveTicket(id);

                return(RedirectToAction("Index"));
            }
            catch {
                return(View());
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult Delete(int id)
        {
            Ticket ticketToDelete = mgr.GetTicket(id);

            if (ticketToDelete == null)
            {
                return(NotFound());
            }

            mgr.RemoveTicket(id);
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            PrintAllTickets();

            mgr.RemoveTicket(1);
            Ticket t = mgr.GetTicket(1);

            if (t != null)
            {
                Console.WriteLine("Ticket {0} has not been removed!");
            }

            Console.WriteLine("Ticket has been removed!\n");

            PrintAllTickets();
            Console.ReadLine();
        }
 public IActionResult DeleteConfirmed(int id)
 {
     mgr.RemoveTicket(id);
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
 public void RemoveTicket(int ticketNumber)
 {
     mgr.RemoveTicket(ticketNumber);
 }