public async Task ThenTheEventsAreCreated()
        {
            await Orchestrator.CreateEvents(_events);

            EventsLogger.Verify(x => x.Info($"Bulk Uploading {_events.Count} Apprenticeship Event", null, null, null));
            Mediator.Verify(m => m.SendAsync(It.Is <BulkUploadCreateApprenticeshipEventsCommand>(x => BulkCommandMatchesEvents(x, _events))), Times.Once);
        }
        public void AndAnExceptionOccursThenTheErrorIsLogged()
        {
            var exception = new Exception("Exception");

            Mediator.Setup(m => m.SendAsync(It.IsAny <BulkUploadCreateApprenticeshipEventsCommand>())).ThrowsAsync(exception);

            Assert.ThrowsAsync <Exception>(() => Orchestrator.CreateEvents(_events));

            EventsLogger.Verify(x => x.Error(exception, exception.Message, null, null, null));
        }
        public void AndValidationFailsThenTheFailureIsLogged()
        {
            var validationException = new ValidationException("Exception");

            Mediator.Setup(m => m.SendAsync(It.IsAny <BulkUploadCreateApprenticeshipEventsCommand>())).ThrowsAsync(validationException);

            Assert.ThrowsAsync <ValidationException>(() => Orchestrator.CreateEvents(_events));

            EventsLogger.Verify(x => x.Warn(validationException, "Invalid apprenticeship event bulk upload request", null, null, null));
        }