Пример #1
0
        public async Task GenerateCorrectFileAsync(int students, int subjects, Language language)
        {
            try
            {
                int studentsCount = 0;
                int subjectsCount = 0;

                studentsCount = students == 0 ? _generatorConfiguration.DefaultStudentsCount : students;
                subjectsCount = subjects == 0 ? _generatorConfiguration.DefaultSubjectsCount : subjects;

                // 1. Generate the data.
                var group = await _testDataGenerator.GenerateDataAsync(studentsCount, subjectsCount, language);

                // 2. Save to the file.
                var filename = _filenameGenerator.GenerateCorrectFilename();

                _fileSaver.SaveDataToFile(filename, group, language);
            }
            catch (Exception ex)
            {
                _logger.LogError("Error during generation of the file!", ex);

                throw;
            }
        }