コード例 #1
0
        public IActionResult Delete(long id)
        {
            var result = new DeleteTicket(repository, ticketCommentRepository, ticketAttributionRepository,
                                          ticketWareRepository, id).Execute();

            if (!result)
            {
                return(NotFound());
            }
            return(Ok());
        }
コード例 #2
0
        public void ShouldFailDeletingTicket()
        {
            var mockTicketRepo = new Mock <ITicketRepository>();

            mockTicketRepo.Setup(m => m.Delete(0)).Returns(false);

            var mockTicketAttrRepo = new Mock <ITicketAttributionRepository>();

            mockTicketAttrRepo.Setup(m => m.GetFromTicket(1)).Returns(new TicketAttribution());

            var mockTicketComRepo = new Mock <ITicketCommentRepository>();

            mockTicketComRepo.Setup(m => m.GetByTicketId(0)).Returns(new List <TicketComment>());

            var mockTicketWareRepo = new Mock <ITicketWareRepository>();

            mockTicketWareRepo.Setup(m => m.GetByTicketId(1)).Returns(new TicketWare());

            var res = new DeleteTicket(mockTicketRepo.Object, mockTicketComRepo.Object, mockTicketAttrRepo.Object,
                                       mockTicketWareRepo.Object, 0).Execute();

            Assert.AreEqual(false, res);
        }