/// <summary>
        /// Generates a given number of images
        /// </summary>
        /// <param name="numberOfFiles">Number of images</param>
        /// <returns></returns>
        public async Task GenerateImages(string numberOfFiles)
        {
            try
            {
                var errors           = new List <string>();
                var validationResult = _inputValidationService.ValidateUserInput(numberOfFiles, errors);
                if (!validationResult)
                {
                    Console.WriteLine(errors.ToJson());
                    return;
                }

                int.TryParse(numberOfFiles, out int result);

                var generatedImages = await _generateImageRepo.ProcessImages(result);

                Console.WriteLine($"{generatedImages} image(s) have been generated and stored at {AppSettings.PathToDocuments}");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
Beispiel #2
0
 public void Test_ProcessImages_Should_Throw_Any_Exception()
 {
     Assert.DoesNotThrowAsync(() => _imageRepository.ProcessImages(1));
 }