c462ed4561
Added new event definitions for "Meet the Candidates", "Chapter Officer Meeting", "Voting Delegate Meeting", and "Social Gathering". Updated the EventOccurrenceParser to handle these new event types and modified related services and views to accommodate the changes. Improved test coverage for the new event definitions and ensured proper parsing and display in the calendar components.
133 lines
4.3 KiB
C#
133 lines
4.3 KiB
C#
using Core.Entities;
|
|
using Core.Parsers;
|
|
|
|
namespace Tests.Parsers;
|
|
|
|
public class EventOccurrenceParser_Tests
|
|
{
|
|
|
|
[Test]
|
|
public void ParseNationalsTest()
|
|
{
|
|
var events = TestEntityHandler.GetEvents();
|
|
var parser = new EventOccurrenceParser(TestEntityHandler.GetEventOccurrenceNationalsFileInfo(), events);
|
|
var dictionary = parser.Parse();
|
|
Console.WriteLine($"Occurrence, Month, Date, Time, Location");
|
|
foreach (var @event in events)
|
|
{
|
|
Console.WriteLine($"{@event.Name}");
|
|
|
|
if (!dictionary.ContainsKey(@event))
|
|
{
|
|
Console.WriteLine("!!! eventDefinition not found " + @event.Name);
|
|
continue;
|
|
}
|
|
var eventOccurrences = dictionary[@event];
|
|
foreach (var eo in eventOccurrences)
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("General Schedule");
|
|
if (dictionary.ContainsKey(EventDefinition.GeneralSchedule))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.GeneralSchedule].OrderBy(occurrence => occurrence.StartTime))
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Meet the Candidates");
|
|
if (dictionary.ContainsKey(EventDefinition.MeetTheCandidates))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.MeetTheCandidates])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Chapter Officer Meeting");
|
|
if (dictionary.ContainsKey(EventDefinition.ChapterOfficerMeeting))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.ChapterOfficerMeeting])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Voting Delegate Meeting");
|
|
if (dictionary.ContainsKey(EventDefinition.VotingDelegateMeeting))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.VotingDelegateMeeting])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Assert.Pass();
|
|
}
|
|
|
|
|
|
[Test]
|
|
public void ParseStatesTest()
|
|
{
|
|
var events = TestEntityHandler.GetEvents();
|
|
var parser = new EventOccurrenceParser(TestEntityHandler.GetEventOccurrenceStateFileInfo(), events);
|
|
var dictionary = parser.Parse();
|
|
Console.WriteLine($"Occurrence, Month, Date, Time, Location");
|
|
foreach (var @event in events)
|
|
{
|
|
Console.WriteLine($"{@event.Name}");
|
|
|
|
if (!dictionary.ContainsKey(@event))
|
|
{
|
|
Console.WriteLine("!!! eventDefinition not found " + @event.Name);
|
|
continue;
|
|
}
|
|
var eventOccurrences = dictionary[@event];
|
|
foreach (var eo in eventOccurrences)
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("General Schedule");
|
|
if (dictionary.ContainsKey(EventDefinition.GeneralSchedule))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.GeneralSchedule].OrderBy(occurrence => occurrence.StartTime))
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Meet the Candidates");
|
|
if (dictionary.ContainsKey(EventDefinition.MeetTheCandidates))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.MeetTheCandidates])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Chapter Officer Meeting");
|
|
if (dictionary.ContainsKey(EventDefinition.ChapterOfficerMeeting))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.ChapterOfficerMeeting])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Console.WriteLine("Voting Delegate Meeting");
|
|
if (dictionary.ContainsKey(EventDefinition.VotingDelegateMeeting))
|
|
{
|
|
foreach (var eo in dictionary[EventDefinition.VotingDelegateMeeting])
|
|
{
|
|
Console.WriteLine($"\t{eo.StartTime.DayOfWeek} {eo.Time}, {eo.Name}, {eo.Location}");
|
|
}
|
|
}
|
|
|
|
Assert.Pass();
|
|
}
|
|
} |