Ejemplo n.º 1
0
        public IActionResult Create([FromBody] CreateTicketInput createTicket)
        {
            var res = new CreateTicket(repository, createTicket).Execute();

            if (res == -1)
            {
                return(Conflict());
            }
            return(Ok(res));
        }
Ejemplo n.º 2
0
        public void ShouldFailCreatingTicket()
        {
            var input          = new CreateTicketInput(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var mockTicketRepo = new Mock <ITicketRepository>();

            mockTicketRepo.Setup(m => m.Create(It.IsAny <Ticket>())).Returns(-1);

            var res = new CreateTicket(mockTicketRepo.Object, input).Execute();

            Assert.AreEqual(-1, res);
        }
Ejemplo n.º 3
0
        public void ShouldCreateTicket()
        {
            var domain         = new Ticket(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var input          = new CreateTicketInput(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var mockTicketRepo = new Mock <ITicketRepository>();

            mockTicketRepo.Setup(m => m.Create(domain)).Returns(0);

            var res = new CreateTicket(mockTicketRepo.Object, input).Execute();

            Assert.AreEqual(0, res);
        }
Ejemplo n.º 4
0
 public CreateTicket(ITicketRepository ticketRepository, CreateTicketInput input)
 {
     this.ticketRepository = ticketRepository;
     Input = input;
 }