public void CheckerCatchesMissingRank() { var data = new[] { new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 1 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 2 }, new TestCalc { Rank = 5, PentaScore = 0f, Absent = false, Id = 3 }, new TestCalc { Rank = 7, PentaScore = 0f, Absent = false, Id = 13 }, new TestCalc { Rank = 4, PentaScore = 0f, Absent = false, Id = 4 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 5 }, }; var c = new RankChecker(); try { c.Check(1, data); Assert.Fail("Missed zero rank"); } catch { } }
public void CheckerCatchesMissingInTeams() { var data = new[] { new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 1 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 2 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 3 }, new TestCalc { Rank = 4, PentaScore = 0f, Absent = false, Id = 13 }, new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 4 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 5 }, }; var c = new RankChecker(); try { c.Check(2, data); Assert.Fail("Missed duplicate"); } catch { } }
public void CheckerHandlesTeams() { var data = new[] { new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 1 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 2 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 3 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 13 }, new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 4 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 5 }, }; var c = new RankChecker(); c.Check(2, data); }
public void CheckerHandlesDuplicateRankWithGapAfter() { var data = new[] { new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 1 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 2 }, new TestCalc { Rank = 5, PentaScore = 0f, Absent = false, Id = 3 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 13 }, new TestCalc { Rank = 6, PentaScore = 0f, Absent = false, Id = 4 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 5 }, }; var c = new RankChecker(); c.Check(1, data); }
public void CheckerGetsRightAnswerInSimpleCase() { var data = new[] { new TestCalc { Rank = 1, PentaScore = 0f, Absent = false, Id = 1 }, new TestCalc { Rank = 3, PentaScore = 0f, Absent = false, Id = 2 }, new TestCalc { Rank = 5, PentaScore = 0f, Absent = false, Id = 3 }, new TestCalc { Rank = 0, PentaScore = 0f, Absent = true, Id = 13 }, new TestCalc { Rank = 4, PentaScore = 0f, Absent = false, Id = 4 }, new TestCalc { Rank = 2, PentaScore = 0f, Absent = false, Id = 5 }, }; var c = new RankChecker(); c.Check(1, data); }
// no button any more private void checkRanks_Click(object sender, RoutedEventArgs e) { var checker = new RankChecker(); try { checker.Check(ViewModel.NumberInTeam, ViewModel.Entrants); } catch (Exception ex) { MessageBox.Show(ex.Message); } }