[SetUp] public void SetUp() { _sut = new LogicalThreadContextCarrierFactory(); ThreadManager = new TestThreadManager(); _freeNamedDataSlot(SlotA); _freeNamedDataSlot(SlotB); //LogicalThreadContext.FreeNamedDataSlot(SlotA); //LogicalThreadContext.FreeNamedDataSlot(SlotB); }
private void Run() { using (_myLock.Lock()) { LockStarted = true; while (!CanAwake) { _condition.AwaitUninterruptibly(); } Interrupted = TestThreadManager.IsCurrentThreadInterrupted(); } }
[Test] public void LockIsNotInterruptibe([Values(true, false)] bool isFair) { _lock = new ReentrantLock(isFair); _lock.Lock(); Thread t1 = ThreadManager.StartAndAssertRegistered( "T1", delegate { _lock.Lock(); Assert.IsTrue(TestThreadManager.IsCurrentThreadInterrupted()); Assert.IsTrue(_lock.IsLocked); Assert.IsTrue(_lock.IsHeldByCurrentThread); _lock.Unlock(); }); t1.Interrupt(); Thread.Sleep(Delays.Short); Assert.IsTrue(t1.IsAlive); Assert.IsTrue(_lock.IsLocked); Assert.IsTrue(_lock.IsHeldByCurrentThread); _lock.Unlock(); ThreadManager.JoinAndVerify(); }
[SetUp] public void SetUp() { _sut = Mockery.GeneratePartialMock <AbstractExecutorService>(); _runnable = MockRepository.GenerateMock <IRunnable>(); _action = MockRepository.GenerateMock <Action>(); _calls = new Func <T> [_size]; _callables = new ICallable <T> [_size]; for (int i = _size - 1; i >= 0; i--) { _callables[i] = MockRepository.GenerateMock <ICallable <T> >(); _calls[i] = MockRepository.GenerateMock <Func <T> >(); } _call = _calls[0]; _callable = _callables[0]; _sut.Stub(x => x.Protected <Action <IRunnable> >("DoExecute")(Arg <IRunnable> .Is.NotNull)) .Do(new Action <IRunnable>(Execute)); _actionOnExecute = r => r.Run(); // Default run it. ThreadManager = new TestThreadManager(); }
[SetUp] public void SetUpThreadManager() { ThreadManager = new TestThreadManager(); }
public ThreadManagerExecutor(TestThreadManager manager) : base(manager) { }
public ManagedThreadFactory(TestThreadManager manager) : base(manager) { }
protected ManagedThreadLimiter(TestThreadManager manager) { _manager = manager; }
public void SetUp() { _sut = new LogicalThreadContextCarrierFactory(); ThreadManager = new TestThreadManager(); _freeNamedDataSlot(SlotA); _freeNamedDataSlot(SlotB); //LogicalThreadContext.FreeNamedDataSlot(SlotA); //LogicalThreadContext.FreeNamedDataSlot(SlotB); }
public virtual void SetUpThreadManager() { ThreadManager = new TestThreadManager(); }