コード例 #1
0
        public void get_by_id_returns_404_NotFound_when_ticket_not_found(
            Guid ticketId,
            TicketNotFoundException notFound,
            [Frozen]Mock<IQuery<Guid, TicketDetails>> ticketQuery,
            TicketsController sut)
        {
            ticketQuery.Setup(q => q.Execute(It.Is<Envelope<Guid>>(t => t.Item == ticketId))).Throws(notFound);

            var actual = sut.Get(ticketId);

            actual.Should().BeOfType<NotFoundResult>("because TicketNotFoundException was thrown by query");
        }
コード例 #2
0
        public void put_returns_404_notfound_when_ticket_not_found(
            Guid ticketId,
            TicketModel ticket,
            TicketNotFoundException exception,
            [Frozen]Mock<ICommand<Ticket>> updateCmd,
            TicketsController sut)
        {
            updateCmd.Setup(cmd => cmd.Execute(It.IsAny<Envelope<Ticket>>())).Throws(exception);

            var actual = sut.Put(ticketId, ticket);

            actual.Should().BeOfType<NotFoundResult>("because TicketNotFoundException was thrown");
        }