Example #1
0
        public async Task ShouldGetAllUnpaidTickets()
        {
            List <TicketsToBuyVm> tickets = new List <TicketsToBuyVm>();

            tickets.Add(new TicketsToBuyVm {
                Id = 1
            });
            await CreateTickets(tickets);

            TicketService    ticketService    = new TicketService(_dbContext, _mainEventProvider);
            TicketController ticketController = new TicketController(ticketService);

            SetUser(ticketController, _createdUser1.Entity.Id);

            ActionResult <List <TicketListVm> > result = await ticketController.GetAllTicketsUserEventUnpaidAsync(1);

            List <TicketListVm> returnedTickets = (List <TicketListVm>)((OkObjectResult)result.Result).Value;

            Assert.AreEqual(1, returnedTickets.Count);
            Assert.AreEqual("Event 1", returnedTickets[0].MainEventName);
            Assert.AreEqual(10, returnedTickets[0].Price);
            Assert.AreEqual("Test ticket type", returnedTickets[0].TicketType);
            Assert.AreEqual(_createdUser1.Entity.Id, returnedTickets[0].UserId);
        }