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.
29 lines
958 B
C#
29 lines
958 B
C#
using GoogleSheetsScheduleImport;
|
|
|
|
namespace Tests.GoogleSheets;
|
|
|
|
[TestFixture]
|
|
public class GlobalEventDeduplicatorTests
|
|
{
|
|
[Test]
|
|
public void Curfew_same_time_multiple_locations_becomes_one_line_without_location()
|
|
{
|
|
var lines = new List<ParsedOccurrenceLine>
|
|
{
|
|
new("CURFEW", "April", 9, "11 p.m. - 12:30 a.m.", "Room A", 10, 10, 1),
|
|
new("CURFEW", "April", 9, "11 p.m. - 12:30 a.m.", "Room B", 10, 10, 2),
|
|
new("Meeting", "April", 9, "9 a.m. - 10 a.m.", "Room A", 5, 5, 1)
|
|
};
|
|
|
|
var result = GlobalEventDeduplicator.Deduplicate(lines);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(result.Count, Is.EqualTo(2));
|
|
var curfew = result.Single(l => l.Name.Equals("CURFEW", StringComparison.OrdinalIgnoreCase));
|
|
Assert.That(curfew.Location, Is.Empty);
|
|
Assert.That(result.Any(l => l.Name == "Meeting"), Is.True);
|
|
});
|
|
}
|
|
}
|