예제 #1
0
        public async Task GetAllTickets_Gets_All()
        {
            var handler = new GetAllTicketsHandler(_context, GetMapper());
            var result  = await handler.Handle(new GetAllTickets(), new System.Threading.CancellationToken());

            CollectionAssert.IsNotEmpty(result.Tickets);
            Assert.AreEqual(_context.Tickets.Count(), result.Tickets.Count());
        }
예제 #2
0
        public async Task GetsCorrectTickets()
        {
            var handler = new GetAllTicketsHandler(_context, GetMapper());
            var result  = await handler.Handle(new GetAllTickets(), new System.Threading.CancellationToken());

            var expected = await _context.Tickets.Select(t => new TicketDTO {
                Id           = t.Id,
                Issue        = t.Issue,
                Issuer       = t.Issuer.Name,
                TicketStatus = (int)t.TicketStatus
            }).ToListAsync();

            CollectionAssert.AreEqual(expected, result.Tickets, new TicketDTOComparer());
        }