feat: add optional student nickname for informal display
Keep legal first and last names for formal lists; show DisplayFirstName on teams, calendars, and import matching so two Josiahs can be told apart. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
using System.Text;
|
||||
using Core.Parsers;
|
||||
using Tests.Builders;
|
||||
|
||||
namespace Tests.Parsers;
|
||||
|
||||
public class TeamParser_Tests
|
||||
@@ -37,4 +41,26 @@ public class TeamParser_Tests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Parse_MatchesNicknameAndLegalStudentColumns()
|
||||
{
|
||||
StudentBuilder.ResetIdCounter();
|
||||
var jo = StudentBuilder.Create("Josiah", "Brown").WithNickname("Jo").Build();
|
||||
var josiahB = StudentBuilder.Create("Josiah", "Green").WithNickname("Josiah B").Build();
|
||||
var coding = EventDefinitionBuilder.Team("Coding", 2, 2).Build();
|
||||
|
||||
const string csv = """
|
||||
Team Name,Event Name,Regional Time Slot,Student 1,Student 2
|
||||
A,Coding,,Jo,Josiah Green
|
||||
""";
|
||||
|
||||
using var reader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(csv)));
|
||||
using var parser = new TeamParser(reader);
|
||||
var teams = parser.Parse([coding], [jo, josiahB]);
|
||||
|
||||
Assert.That(teams, Has.Length.EqualTo(1));
|
||||
Assert.That(teams[0].Students.Select(s => s.Id), Is.EquivalentTo(new[] { jo.Id, josiahB.Id }));
|
||||
Assert.That(teams[0].Captain!.Id, Is.EqualTo(jo.Id));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user