Beispiel #1
0
        public ActionResult AddBooking(int id)
        {
            _ticketServices = new TicketServices();
            var model = _ticketServices.GetTicketById(id);

            _ticketServices.UpdateStatusTicket(model);
            int idUser = (int)TempData["idUser"];

            _ticketServices.AddBooking(idUser, model.Id);
            return(RedirectToAction("TicketForSeance", new { id = model.Seance.Id }));
        }
        public void GetTicketById_ValidTicketId_ExpectValidTicketDto()
        {
            var ticketReturned = new Domain.Core.Ticket
            {
                Id           = Guid.NewGuid(),
                Name         = "Santiago",
                LastName     = "Arias",
                Area         = Aplication.Enums.TicketArea.Otros,
                Description  = "Una descripcion de ticket",
                CreationDate = DateTime.Now,
                Email        = "*****@*****.**",
                Number       = 12345,
                Telephone    = "154187286"
            };

            var ticketDto = new DataTransferObjects.Ticket.TicketDto()
            {
                Id           = ticketReturned.Id,
                Name         = ticketReturned.Name,
                LastName     = ticketReturned.LastName,
                CreationDate = ticketReturned.CreationDate,
                Description  = ticketReturned.Description,
                TicketArea   = ticketReturned.Area,
                Email        = ticketReturned.Email,
                Number       = ticketReturned.Number,
                Telephone    = ticketReturned.Telephone
            };

            _mapper.Setup(x => x.Map <Domain.Core.Ticket, DataTransferObjects.Ticket.TicketDto>(It.IsAny <Domain.Core.Ticket>()))
            .Returns(ticketDto);
            _ticketRepository.Setup(x => x.GetById(It.IsAny <Guid>(), It.IsAny <string>())).Returns(ticketReturned);
            var ticketServices = new TicketServices(_ticketRepository.Object, _uow.Object, _mapper.Object);

            var response = ticketServices.GetTicketById(Guid.NewGuid());

            response.Should().BeOfType(typeof(DataTransferObjects.Ticket.TicketDto));
            response.Should().NotBeNull();
            response.Id.Should().NotBeNull();
            response.Name.Should().Be("Santiago");
        }