Telerik JustMock
[TestMethod]
public
void
ShouldInvokeMockInsideAChildThreadFromThreadPool()
{
var mockable = Mock.Create<Mockable>();
Mock.Arrange(() => mockable.IsMocked).Returns(
true
);
bool
mocked =
false
;
var latch =
new
WaitLatch();
ThreadPool.QueueUserWorkItem((cookie) =>
{
try
{
mocked = mockable.IsMocked;
}
finally
{
latch.Signal();
}
});
latch.Wait();
Assert.IsTrue(mocked);
}