diff --git a/Tests/Parsers/EventOccurrenceParser_Tests.cs b/Tests/Parsers/EventOccurrenceParser_Tests.cs index 7d30170..1aabd60 100644 --- a/Tests/Parsers/EventOccurrenceParser_Tests.cs +++ b/Tests/Parsers/EventOccurrenceParser_Tests.cs @@ -1,4 +1,5 @@ using Core.Entities; +using Core.Models; using Core.Parsers; namespace Tests.Parsers; @@ -134,4 +135,136 @@ public class EventOccurrenceParser_Tests Assert.Pass(); } + + [Test] + public void Analyze_2025Nationals_ParsingResults() + { + // Arrange + var events = TestEntityHandler.GetEvents(); + var fileInfo = TestEntityHandler.GetEventOccurrenceNationalsFileInfo(); + var locationConfig = LocationParsingConfiguration.Default; + var parser = new EventOccurrenceParser(fileInfo, events, locationConfig); + + // Act + var result = parser.Parse(); + + // Assert - Should parse without exceptions + Assert.That(result, Is.Not.Null, "Parser should return a result"); + + // Analyze and report results + var totalLines = File.ReadAllLines(fileInfo.FullName).Length; + var issuesByType = result.Issues.GroupBy(i => i.IssueType).ToDictionary(g => g.Key, g => g.Count()); + var totalParsed = result.Occurrences.Values.Sum(list => list.Count); + + Console.WriteLine($"\n=== 2025 TSA Nationals Competition Event Times Analysis ==="); + Console.WriteLine($"Total lines in file: {totalLines}"); + Console.WriteLine($"Total occurrences parsed: {totalParsed}"); + Console.WriteLine($"Total issues found: {result.Issues.Count}"); + Console.WriteLine($"Issues by type:"); + foreach (var kvp in issuesByType.OrderByDescending(x => x.Value)) + { + Console.WriteLine($" {kvp.Key}: {kvp.Value}"); + } + Console.WriteLine($"Events with occurrences: {result.Occurrences.Count}"); + Console.WriteLine($"Special events found:"); + if (result.Occurrences.ContainsKey(EventDefinition.GeneralSchedule)) + Console.WriteLine($" GeneralSchedule: {result.Occurrences[EventDefinition.GeneralSchedule].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.MeetTheCandidates)) + Console.WriteLine($" MeetTheCandidates: {result.Occurrences[EventDefinition.MeetTheCandidates].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.ChapterOfficerMeeting)) + Console.WriteLine($" ChapterOfficerMeeting: {result.Occurrences[EventDefinition.ChapterOfficerMeeting].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.VotingDelegateMeeting)) + Console.WriteLine($" VotingDelegateMeeting: {result.Occurrences[EventDefinition.VotingDelegateMeeting].Count} occurrences"); + + // Test passes if no exceptions were thrown + Assert.Pass($"Successfully parsed {totalParsed} occurrences with {result.Issues.Count} issues"); + } + + [Test] + public void Analyze_2025State_ParsingResults() + { + // Arrange + var events = TestEntityHandler.GetEvents(); + var fileInfo = TestEntityHandler.GetEventOccurrenceStateFileInfo(); + var locationConfig = LocationParsingConfiguration.Default; + var parser = new EventOccurrenceParser(fileInfo, events, locationConfig); + + // Act + var result = parser.Parse(); + + // Assert - Should parse without exceptions + Assert.That(result, Is.Not.Null, "Parser should return a result"); + + // Analyze and report results + var totalLines = File.ReadAllLines(fileInfo.FullName).Length; + var issuesByType = result.Issues.GroupBy(i => i.IssueType).ToDictionary(g => g.Key, g => g.Count()); + var totalParsed = result.Occurrences.Values.Sum(list => list.Count); + + Console.WriteLine($"\n=== 2025 TN TSA State Competition Event Times Analysis ==="); + Console.WriteLine($"Total lines in file: {totalLines}"); + Console.WriteLine($"Total occurrences parsed: {totalParsed}"); + Console.WriteLine($"Total issues found: {result.Issues.Count}"); + Console.WriteLine($"Issues by type:"); + foreach (var kvp in issuesByType.OrderByDescending(x => x.Value)) + { + Console.WriteLine($" {kvp.Key}: {kvp.Value}"); + } + Console.WriteLine($"Events with occurrences: {result.Occurrences.Count}"); + Console.WriteLine($"Special events found:"); + if (result.Occurrences.ContainsKey(EventDefinition.GeneralSchedule)) + Console.WriteLine($" GeneralSchedule: {result.Occurrences[EventDefinition.GeneralSchedule].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.MeetTheCandidates)) + Console.WriteLine($" MeetTheCandidates: {result.Occurrences[EventDefinition.MeetTheCandidates].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.ChapterOfficerMeeting)) + Console.WriteLine($" ChapterOfficerMeeting: {result.Occurrences[EventDefinition.ChapterOfficerMeeting].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.VotingDelegateMeeting)) + Console.WriteLine($" VotingDelegateMeeting: {result.Occurrences[EventDefinition.VotingDelegateMeeting].Count} occurrences"); + + // Test passes if no exceptions were thrown + Assert.Pass($"Successfully parsed {totalParsed} occurrences with {result.Issues.Count} issues"); + } + + [Test] + public void Analyze_2024State_ParsingResults() + { + // Arrange + var events = TestEntityHandler.GetEvents(); + var fileInfo = TestEntityHandler.GetEventOccurrenceState2024FileInfo(); + var locationConfig = LocationParsingConfiguration.Default; + var parser = new EventOccurrenceParser(fileInfo, events, locationConfig); + + // Act + var result = parser.Parse(); + + // Assert - Should parse without exceptions + Assert.That(result, Is.Not.Null, "Parser should return a result"); + + // Analyze and report results + var totalLines = File.ReadAllLines(fileInfo.FullName).Length; + var issuesByType = result.Issues.GroupBy(i => i.IssueType).ToDictionary(g => g.Key, g => g.Count()); + var totalParsed = result.Occurrences.Values.Sum(list => list.Count); + + Console.WriteLine($"\n=== 2024 TN TSA State Competition Event Times Analysis ==="); + Console.WriteLine($"Total lines in file: {totalLines}"); + Console.WriteLine($"Total occurrences parsed: {totalParsed}"); + Console.WriteLine($"Total issues found: {result.Issues.Count}"); + Console.WriteLine($"Issues by type:"); + foreach (var kvp in issuesByType.OrderByDescending(x => x.Value)) + { + Console.WriteLine($" {kvp.Key}: {kvp.Value}"); + } + Console.WriteLine($"Events with occurrences: {result.Occurrences.Count}"); + Console.WriteLine($"Special events found:"); + if (result.Occurrences.ContainsKey(EventDefinition.GeneralSchedule)) + Console.WriteLine($" GeneralSchedule: {result.Occurrences[EventDefinition.GeneralSchedule].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.MeetTheCandidates)) + Console.WriteLine($" MeetTheCandidates: {result.Occurrences[EventDefinition.MeetTheCandidates].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.ChapterOfficerMeeting)) + Console.WriteLine($" ChapterOfficerMeeting: {result.Occurrences[EventDefinition.ChapterOfficerMeeting].Count} occurrences"); + if (result.Occurrences.ContainsKey(EventDefinition.VotingDelegateMeeting)) + Console.WriteLine($" VotingDelegateMeeting: {result.Occurrences[EventDefinition.VotingDelegateMeeting].Count} occurrences"); + + // Test passes if no exceptions were thrown + Assert.Pass($"Successfully parsed {totalParsed} occurrences with {result.Issues.Count} issues"); + } } \ No newline at end of file diff --git a/Tests/Parsers/TestEntityHandler.cs b/Tests/Parsers/TestEntityHandler.cs index d96ffa4..fc6d5c8 100644 --- a/Tests/Parsers/TestEntityHandler.cs +++ b/Tests/Parsers/TestEntityHandler.cs @@ -27,6 +27,11 @@ public static class TestEntityHandler return FileUtility.GetContentFile(ContentDirectory, "2025 TN TSA State Competition Event Times.txt"); } + public static FileInfo GetEventOccurrenceState2024FileInfo() + { + return FileUtility.GetContentFile(ContentDirectory, "2024 TN TSA State Competition Event Times.txt"); + } + public static Student[] GetStudents(IList events) { //var studentEventRankingsCsv = "Student Event Rankings.csv";