Friday, February 03, 2012
by
Just* Team
|
Comments
Telerik JustMock received many new features in the service pack for the Q3 2011 release, enhancing the mocking framework’s impressive ability to mock almost everything. Let’s take a look at a few highlights of JustMock Q3 2011 SP.
Mock Inside a Threadpool
Mock objects can be accessed inside of another thread and work as expected.
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); The callback for ThreadPool.QueueUserWorkItem accesses ...