public void TestLoadTeams() { File.WriteAllText(TestFileName, "Name,Seed,Region\n" + "UCLA,1,West\n" + "USC,2,South\n" + "California,3,North\n"); var bracket = new Bracket(); bracket.LoadTeams(TestFileName); Assert.AreEqual(0, bracket.RoundNumber); Assert.AreEqual(3, bracket.Teams.Count); Assert.AreEqual(0, bracket.Rounds.Count); Assert.AreEqual(false, bracket.IsComplete()); var teams = bracket.AllTeams.OrderBy(team => team.Seed).ToList(); Assert.AreEqual("UCLA", teams[0].Name); Assert.AreEqual(1, teams[0].Seed); Assert.AreEqual("West", teams[0].Region); Assert.AreEqual("USC", teams[1].Name); Assert.AreEqual(2, teams[1].Seed); Assert.AreEqual("South", teams[1].Region); Assert.AreEqual("California", teams[2].Name); Assert.AreEqual(3, teams[2].Seed); Assert.AreEqual("North", teams[2].Region); }
public void TestLoadTeamsInvalidFileContent() { File.WriteAllText(TestFileName, "Name,Seed,Region\n" + "UCLA\n" + "USC,2,South\n" + "California,3,North\n"); var bracket = new Bracket(); Assert.ThrowsException <Exception>(() => bracket.LoadTeams(TestFileName)); }
public void TestLoadTeamsInvalidFilename() { var bracket = new Bracket(); Assert.ThrowsException <FileNotFoundException>(() => bracket.LoadTeams("invalid.csv")); }