示例#1
0
        public void TaskRunnerBasicTest()
        {
            string[] strs = { "one", "two", "three", "four", "five", "six", "seven" };

            var runner = new MockJobRunner(3);

            runner.Run();
            strs.ToList().ForEach(runner.EnqueueJob);
            runner.Stop();
            Assert.AreEqual(runner.Result, string.Join("", strs));
        }
示例#2
0
        public void TaskRunnerCanReEnter()
        {
            string[] strs = { "one", "two", "three", "four", "five", "six", "seven" };

            var runner = new MockJobRunner(3);

            runner.Run();

            strs.Take(2).ToList().ForEach(runner.EnqueueJob);
            Thread.Sleep(TimeSpan.FromMilliseconds(10000));
            runner.EnqueueRange(strs.Skip(2));
            runner.Stop();
            Assert.AreEqual(runner.Result, string.Join("", strs));
        }