Beispiel #1
0
        public void TestRefreshJobRevoke()
        {
            RefreshJob.REFRESH_INTERVAL = 250;
            Assert.That(RefreshJob.Count, Is.EqualTo(0));
            var rs1 = new MockAlwaysRefreshableResource();
            var rs2 = new MockAlwaysRefreshableResource();

            Assert.That(rs1.LoadCount, Is.EqualTo(1));
            Assert.That(rs2.LoadCount, Is.EqualTo(1));
            Thread.Sleep(RefreshJob.REFRESH_INTERVAL * 3);
            Assert.That(rs1.LoadCount, Is.GreaterThan(1));
            Assert.That(rs2.LoadCount, Is.GreaterThan(1));

            RefreshJob.RevokeAll();
            int old1 = rs1.LoadCount;
            int old2 = rs2.LoadCount;

            Thread.Sleep(RefreshJob.REFRESH_INTERVAL * 3);
            Assert.That(rs1.LoadCount, Is.EqualTo(old1));
            Assert.That(rs2.LoadCount, Is.EqualTo(old2));
        }
Beispiel #2
0
 public void TearDown()
 {
     RefreshJob.RevokeAll();
 }