public void execute_throws_concurrency_exception_when_versions_dont_match(
            Envelope<Ticket> ticket,
            TicketDetails existingTicket,
            Mock<IQuery<Guid, TicketDetails>> getTicketQuery,
            Mock<ICommand<Ticket>> inner)
        {
            getTicketQuery.Setup(q => q.Execute(It.Is<Envelope<Guid>>(t => t.Item == ticket.Item.TicketId)))
                          .Returns(existingTicket);

            var sut = new TicketConcurrentUpdatesDetector<Ticket>(inner.Object, getTicketQuery.Object);

            sut.Invoking(cmd => cmd.Execute(ticket)).ShouldThrow<OptimisticConcurrencyException>();
        }
        public void execute_call_inner_command(
            Envelope<Ticket> ticket,
            TicketDetails existingTicket,
            Mock<IQuery<Guid, TicketDetails>> getTicketQuery,
            Mock<ICommand<Ticket>> inner)
        {
            existingTicket.Version = ticket.Item.ExpectedVersion;
            getTicketQuery.Setup(q => q.Execute(It.Is<Envelope<Guid>>(t => t.Item == ticket.Item.TicketId)))
                          .Returns(existingTicket);
            var sut = new TicketConcurrentUpdatesDetector<Ticket>(inner.Object, getTicketQuery.Object);

            sut.Execute(ticket);

            inner.Verify(c => c.Execute(ticket), Times.Once);
        }