Example #1
0
        public void ForcedInspection()
        {
            DateTime now = DateTime.UtcNow;

            //set up a program
            var inspProg  = new JobInspectionData("insp1", "counter1", 13, TimeSpan.FromHours(11));
            var inspProg2 = new JobInspectionData(inspProg);

            //set the count as zero, otherwise it chooses a random
            InspectCount cnt = new InspectCount();

            cnt.Counter = "counter1";
            cnt.Value   = 0;
            cnt.LastUTC = DateTime.UtcNow.AddHours(-10);
            _insp.SetInspectCounts(new InspectCount[] { cnt });

            //try making a decision
            _insp.ForceInspection(2, "insp1");

            _insp.MakeInspectionDecisions(1, 1, new[] { inspProg }, now);
            _insp.MakeInspectionDecisions(1, 1, new[] { inspProg }, now);
            CheckDecision(1, "insp1", "counter1", false, now);
            CheckCount("counter1", 1);

            _insp.MakeInspectionDecisions(2, 1, new[] { inspProg2 }, now);
            CheckDecision(2, "insp1", "counter1", true, now, true);

            CheckCount("counter1", 2);
        }