public void IsJudgedTest_blank_no()
        {
            var rc = new RoundContestant();

            rc.EnsureListsAreInitialized();
            bool result = rc.IsJudged(12);

            Assert.IsFalse(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_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_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);
        }