tag:blogger.com,1999:blog-584619127557205820.post4732831739901216796..comments2023-06-03T10:07:10.249+02:00Comments on Plain Old Stan: Run unit test on MTA thread. VSTS test runner helper.stanhttp://www.blogger.com/profile/17953164778965672435noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-584619127557205820.post-83367475114025783732010-10-15T11:54:35.740+02:002010-10-15T11:54:35.740+02:00Excellent. We'll use this for testing DTSX pac...Excellent. We'll use this for testing DTSX packages (container expressions that set data transformation properties need MTAThread). Thanks.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-584619127557205820.post-82470243989792703272008-09-22T20:45:00.000+02:002008-09-22T20:45:00.000+02:00Testing multi-threaded or asynchronous code is a b...Testing multi-threaded or asynchronous code is a bit of a minefield, so whenever you can factor your code so that the threading and synchronization only becomes a thin implementation 'layer' on top of some deterministic, synchronous code, you should to so.<BR/><BR/>That said, if you have this requirement for your tests, I think your idea is viable. You may want to consider adding some kind of timeout so that the Execute method doesn't block forever.<BR/><BR/>To implement this in the most robust way, I'd recommend that you take a look on Jeffrey Richter's article "Concurrent Affairs: Implementing the CLR Asynchronous Programming Model" (http://msdn.microsoft.com/msdnmag/issues/07/03/ConcurrentAffairs/) and use his AsyncResultNoResult class to implement your helper class. That's both going to give your helper class a more robust implementation and a more flexible API.Anonymousnoreply@blogger.com