Esempio n. 1
0
 public void TestBusyLockObject()
 {
     BusyBO busy = new BusyBO();
       busy.MarkBusy(true);
       using (BusyLocker bl = new BusyLocker(busy, TimeSpan.FromSeconds(1)))
       {
     System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
     worker.DoWork += (o, e) => busy.MarkBusy(false);
     worker.RunWorkerAsync();
       }
       Assert.IsFalse(busy.IsBusy);
 }
Esempio n. 2
0
        public void TestBusyLockObject()
        {
            BusyBO busy = new BusyBO();

            busy.MarkBusy(true);
            using (BusyLocker bl = new BusyLocker(busy, TimeSpan.FromSeconds(1)))
            {
                System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
                worker.DoWork += (o, e) => busy.MarkBusy(false);
                worker.RunWorkerAsync();
            }
            Assert.IsFalse(busy.IsBusy);
        }
Esempio n. 3
0
    public void SimpleLock()
    {
      BusyBO busy = new BusyBO();
      busy.MarkBusy(true);
      System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
      worker.DoWork += (o, e) => 
      {
        System.Threading.Thread.Sleep(10);
        busy.MarkBusy(false);
      };
      worker.RunWorkerAsync();

      BusyLock.WaitOne(busy);
      Assert.IsFalse(busy.IsBusy);
    }
Esempio n. 4
0
 public void TestTimeout()
 {
   BusyBO busy = new BusyBO();
   busy.MarkBusy(true);
   BusyLock.WaitOne(busy, TimeSpan.FromMilliseconds(10));
   Assert.IsTrue(busy.IsBusy);
 }
Esempio n. 5
0
        public void SimpleLock()
        {
            BusyBO busy = new BusyBO();

            busy.MarkBusy(true);
            System.ComponentModel.BackgroundWorker worker = new System.ComponentModel.BackgroundWorker();
            worker.DoWork += (o, e) =>
            {
                System.Threading.Thread.Sleep(10);
                busy.MarkBusy(false);
            };
            worker.RunWorkerAsync();

            BusyLock.WaitOne(busy);
            Assert.IsFalse(busy.IsBusy);
        }
Esempio n. 6
0
        public void TestTimeout()
        {
            BusyBO busy = new BusyBO();

            busy.MarkBusy(true);
            BusyLock.WaitOne(busy, TimeSpan.FromMilliseconds(10));
            Assert.IsTrue(busy.IsBusy);
        }