public void ExtractFromMovements(string lessonNumber) { using (ApprovalResults.ForScenario(lessonNumber)) { var xlsxFile = TestDataDirectory.GetOrCreateSubDirectory("InputData") .GetFiles() .First(x => x.Name == "Movements.xlsx"); var document = new XlsxDocumentReader().Read(xlsxFile.FullName); var movements = new LessonMovementsExtractor().Extract(document, lessonNumber); var json = JsonConvert.SerializeObject(movements, Formatting.Indented); Approvals.VerifyJson(json); } }
private static void CreateLesson(LessonDocumentCreatingOptions options) { var excelDocumentReader = new XlsxDocumentReader(); var lessonExtractor = new LessonMovementsExtractor(); var movementsDocument = excelDocumentReader.Read(options.MovementsFile.FullName); var warmupMovementsDocument = excelDocumentReader.Read(options.WarmupMovementsFile.FullName); var movements = lessonExtractor.Extract(movementsDocument, options.LessonNumber); var warmupMovements = lessonExtractor.Extract(warmupMovementsDocument, options.LessonNumber); using (var writer = new FileWriter(options.LessonFilename)) { new LessonPrinter().Print(warmupMovements, movements, writer); } }
private static void ValidateLesson(LessonDocumentValidationOptions options) { var excelDocumentReader = new XlsxDocumentReader(); var lessonExtractor = new LessonMovementsExtractor(); var movementsDocument = excelDocumentReader.Read(options.MovementsFile.FullName); var warmupMovementsDocument = excelDocumentReader.Read(options.WarmupMovementsFile.FullName); var movements = lessonExtractor.Extract(movementsDocument, options.LessonNumber); var warmupMovements = lessonExtractor.Extract(warmupMovementsDocument, options.LessonNumber); var lesson = new LessonDocumentReader().Read(options.LessonFile.FullName); var validationResult = new LessonValidator().Validate(warmupMovements, movements, lesson); using (var writer = new FileWriter(options.ValidationResultFilename)) { new ValidationResultPrinter().Print(validationResult, writer); } }