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.
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using GoogleSheetsScheduleImport;
|
|
|
|
namespace Tests.GoogleSheets;
|
|
|
|
[TestFixture]
|
|
public class ScheduleGridExtractorTests
|
|
{
|
|
[Test]
|
|
public void Extract_SingleBlock_OneOccurrenceWithEndTimeFromNextSlot()
|
|
{
|
|
string?[][] values =
|
|
[
|
|
[null, "Main Hall"],
|
|
["9:00 a.m.", "Opening Ceremony"],
|
|
["10:00 a.m.", null]
|
|
];
|
|
string?[][] bg =
|
|
[
|
|
[null, null],
|
|
[null, null],
|
|
[null, null]
|
|
];
|
|
var grid = new GridSheetModel
|
|
{
|
|
SheetTitle = "Day1",
|
|
Values = values,
|
|
BackgroundKeys = bg
|
|
};
|
|
var warnings = new List<string>();
|
|
var lines = ScheduleGridExtractor.Extract(grid, "April", 2, warnings);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(lines, Has.Count.EqualTo(1));
|
|
Assert.That(lines[0].Name, Is.EqualTo("Opening Ceremony"));
|
|
Assert.That(lines[0].Month, Is.EqualTo("April"));
|
|
Assert.That(lines[0].Day, Is.EqualTo(2));
|
|
Assert.That(lines[0].Location, Is.EqualTo("Main Hall"));
|
|
Assert.That(lines[0].TimeRange, Is.EqualTo("9 a.m. - 10 a.m."));
|
|
});
|
|
}
|
|
}
|