public async Task WhenAuditableRequest_ShouldCreateAuditWithSuccessOutcome()
        {
            var sut = new RequestAuditBehavior <SomeAuditableCommand, Guid>(mockAuditor.Object);

            var result = await sut.Handle(
                new SomeAuditableCommand(),
                new CancellationToken(),
                mockSuccessHandler.Object);

            mockSuccessHandler.Verify(_ => _(), Times.Once);
            mockAuditor.Verify(x => x.AddAsync(It.Is <Audit>(a => a.Outcome == AuditOutcome.Success &&
                                                             a.Entry == auditEntry)), Times.Once);
        }
        public async Task WhenNotAnAuditableRequestAndNoErrorOccured_ShouldNotCreateAudit()
        {
            var sut = new RequestAuditBehavior <SomeQuery, Guid>(mockAuditor.Object);

            var exception = await Record.ExceptionAsync(() =>
                                                        sut.Handle(
                                                            new SomeQuery(),
                                                            new CancellationToken(),
                                                            mockSuccessHandler.Object)
                                                        );

            exception.Should().BeNull();
            mockAuditor.Verify(x => x.AddAsync(It.IsAny <Audit>()), Times.Never);
            mockSuccessHandler.Verify(_ => _(), Times.Once);
        }
        public async Task WhenAuditableRequestAndErrorOccurs_ShouldCreateAuditWithFailureOutcome()
        {
            var sut = new RequestAuditBehavior <SomeAuditableCommand, Guid>(mockAuditor.Object);

            var exception = await Record.ExceptionAsync(() =>
                                                        sut.Handle(
                                                            new SomeAuditableCommand(),
                                                            new CancellationToken(),
                                                            mockFailHandler.Object)
                                                        );

            exception.Should().NotBeNull();
            exception.Message.Should().Be(ErrorMessage);

            mockAuditor.Verify(x => x.AddAsync(It.Is <Audit>(a => a.Outcome == AuditOutcome.Failure &&
                                                             a.Reason == ErrorMessage &&
                                                             a.Entry == auditEntry)), Times.Once);

            mockFailHandler.Verify(_ => _(), Times.Once);
        }