public void Status() { Extension.Scheduler.RedisScheduler scheduler = GetRedisScheduler(); ISpider spider = new DefaultSpider("test", new Site()); scheduler.Init(spider); scheduler.Dispose(); scheduler.Push(new Request("http://www.a.com/", null)); scheduler.Push(new Request("http://www.b.com/", null)); scheduler.Push(new Request("http://www.c.com/", null)); scheduler.Push(new Request("http://www.d.com/", null)); Assert.Equal(0, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetLeftRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.IncreaseErrorCounter(); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(0, scheduler.GetSuccessRequestsCount()); scheduler.IncreaseSuccessCounter(); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); scheduler.Poll(); Assert.Equal(3, scheduler.GetLeftRequestsCount()); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.Poll(); Assert.Equal(2, scheduler.GetLeftRequestsCount()); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.Poll(); Assert.Equal(1, scheduler.GetLeftRequestsCount()); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.Poll(); Assert.Equal(0, scheduler.GetLeftRequestsCount()); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.Poll(); scheduler.Poll(); Assert.Equal(0, scheduler.GetLeftRequestsCount()); Assert.Equal(1, scheduler.GetSuccessRequestsCount()); Assert.Equal(1, scheduler.GetErrorRequestsCount()); Assert.Equal(4, scheduler.GetTotalRequestsCount()); scheduler.Dispose(); }