예제 #1
0
        public void Cleanup()
        {
            if (ResolveMediator.ContainerBuilt)
            {
                ResolveMediator.Dispose();
            }

            ScheduleMediator.Clear();
        }
예제 #2
0
        public void TestScheduleTimePoint_Error()
        {
            //清空调度任务
            ScheduleMediator.Clear();

            //开始调度,在当前时间2秒后执行
            ScheduleMediator.Schedule(StubAlarmTask.Detail, DateTime.Now.AddSeconds(2));

            Assert.IsNull(StubAlarmTask.ReferenceParam);
        }
예제 #3
0
        public void Init()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            ScheduleMediator.Clear();
        }
예제 #4
0
        public void TestScheduleInspect_Error()
        {
            //清空调度任务
            ScheduleMediator.Clear();

            //清空参考系
            StubShowTimeTask.ReferenceTimes.Clear();

            //开始调度,每2秒执行一次
            ScheduleMediator.ScheduleBySecond(StubShowTimeTask.Detail, 2);

            Assert.IsTrue(!StubShowTimeTask.ReferenceTimes.Any());
        }
예제 #5
0
        public void TestScheduleInspect()
        {
            //清空调度任务
            ScheduleMediator.Clear();

            //清空参考系
            StubShowTimeTask.ReferenceTimes.Clear();

            //开始调度,每2秒执行一次
            ScheduleMediator.ScheduleBySecond(StubShowTimeTask.Detail, 2);

            //线程睡眠
            Thread.Sleep(4100);

            Assert.IsTrue(StubShowTimeTask.ReferenceTimes.Count == 3);
        }