public void IsJudgedBy_Run1Judge1With2Criteras() { var j1 = new Judge() { Id = 1 }; var rc = new RoundContestant() { Id = 3 }; var crit1 = new JudgingCriterion() { Id = 6 }; var crit2 = new JudgingCriterion() { Id = 7 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging(rc, j1, crit1, 1, 3.0M)); rc.ReplaceRunJudging(new RunJudging(rc, j1, crit2, 1, 3.0M)); var result = rc.IsJudgedBy(j1, 1, 2); Assert.IsTrue(result); }
public void ReplaceRunJudging_NewItem_Added() { var crit1 = new JudgingCriterion() { Id = 5 }; var crit2 = new JudgingCriterion() { Id = 9 }; var judge = new Judge() { Id = 8 }; var rc = new RoundContestant() { Id = 7 }; rc.EnsureListsAreInitialized(); var j1 = new RunJudging() { Id = 1, Criterion = crit1, Judge = judge, Score = 7, RoundContestant = rc, RunNo = 1 }; rc.ReplaceRunJudging(j1); Assert.AreEqual(1, rc.RunJudgings.Count); Assert.AreSame(j1, rc.RunJudgings.First()); }
public void IsJudgedBy_Run1Judge2NotExists() { var j1 = new Judge() { Id = 1 }; var j2 = new Judge() { Id = 2 }; var rc = new RoundContestant() { Id = 3 }; var crit = new JudgingCriterion() { Id = 6 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1, Criterion = crit, JudgeId = j1.Id }); var result = rc.IsJudgedBy(j2, 1, 1); Assert.IsFalse(result); }
public void IsJudgedTest_1by2butonly1_true() { var j1 = new Judge() { Id = 7 }; var rc = new RoundContestant() { Id = 5 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1 }); bool result = rc.IsJudged(1); Assert.IsTrue(result); }
public void IsJudgedTest_3by2yields6withOneNullScore_true() { var j1 = new Judge() { Id = 1 }; var j2 = new Judge() { Id = 2 }; var rc = new RoundContestant() { Id = 3 }; var crit = new JudgingCriterion() { Id = 6 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j2, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 4, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = null, Judge = j2, Criterion = crit }.SetIdFromObjects()); // Null score = concious "no score"-mark rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 5, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 1, Judge = j2, Criterion = crit }.SetIdFromObjects()); foreach (var rj in rc.RunJudgings) { rj.SetIdFromObjects(); } bool result = rc.IsJudged(6); Assert.IsTrue(result); }
public void IsJudgedTest_OnlyOneOfTwoCriterion_false() { var j1 = new Judge() { Id = 4 }; var j2 = new Judge() { Id = 1 }; var rc = new RoundContestant() { Id = 7 }; var crit = new JudgingCriterion() { Id = 65 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j2, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 4, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 5, Judge = j2, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 5, Judge = j1, Criterion = crit }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 1, Judge = j2, Criterion = crit }.SetIdFromObjects()); bool result = rc.IsJudged(12); Assert.IsFalse(result); }
public void IsJudgedTest_3by2by2_true() { var c1 = new JudgingCriterion() { Id = 7 }; var c2 = new JudgingCriterion() { Id = 8 }; var j1 = new Judge() { Id = 1 }; var j2 = new Judge() { Id = 2 }; var rc = new RoundContestant() { Id = 10 }; rc.EnsureListsAreInitialized(); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j2, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 4, Judge = j1, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 5, Judge = j2, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 5, Judge = j1, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 1, Judge = j2, Criterion = c1 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j1, Criterion = c2 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 1, Score = 3, Judge = j2, Criterion = c2 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 4, Judge = j1, Criterion = c2 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 2, Score = 5, Judge = j2, Criterion = c2 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 5, Judge = j1, Criterion = c2 }.SetIdFromObjects()); rc.ReplaceRunJudging(new RunJudging { RoundContestant = rc, RunNo = 3, Score = 1, Judge = j2, Criterion = c2 }.SetIdFromObjects()); foreach (var rj in rc.RunJudgings) { rj.SetIdFromObjects(); } bool result = rc.IsJudged(12); Assert.IsTrue(result); }