Update EventOccurrence parsing to use EventOccurrenceParseGroup for improved data structure
This commit refactors the EventOccurrence parsing logic to utilize the EventOccurrenceParseGroup class, enhancing the organization of parsed occurrences by grouping them based on event definitions and optional section levels. The changes include updates to the EventOccurrenceParseResult, EventOccurrenceParser, and EventOccurrenceParserService to accommodate the new grouping structure. Additionally, tests are modified to reflect these changes, ensuring that the parsing functionality remains intact and accurate. This refactor improves data handling and aligns with the overall architecture of the application.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Core.Entities;
|
||||
using GoogleSheetsScheduleImport;
|
||||
|
||||
namespace Tests.GoogleSheets;
|
||||
|
||||
[TestFixture]
|
||||
public class ImportTextEmitterRoundTripTests
|
||||
{
|
||||
[Test]
|
||||
public void EmittedText_Parses_UnderGeneralSchedule()
|
||||
{
|
||||
var sheets = new List<(string SheetTitle, string SectionHeader, List<ParsedOccurrenceLine> Lines)>
|
||||
{
|
||||
("Thursday", "General Schedule", new List<ParsedOccurrenceLine>
|
||||
{
|
||||
new(
|
||||
Name: "Opening Ceremony",
|
||||
Month: "April",
|
||||
Day: 3,
|
||||
TimeRange: "9 a.m. - 10 a.m.",
|
||||
Location: "Main Hall",
|
||||
SourceRowStart: 1,
|
||||
SourceRowEnd: 1,
|
||||
SourceCol: 1)
|
||||
})
|
||||
};
|
||||
|
||||
var text = ImportTextEmitter.Build(sheets);
|
||||
var result = ParserRoundTripValidator.Validate(text, new List<EventDefinition>
|
||||
{
|
||||
EventDefinition.GeneralSchedule
|
||||
});
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(result.IsSuccess, Is.True, string.Join("; ", result.Errors));
|
||||
Assert.That(result.TotalParsed, Is.EqualTo(1));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user