Yossi Dahan [BizTalk]


Friday, October 08, 2010

Visual Studio 2008, unit testing and partial classes

Been working on some code for which I have a decent amount of unit tests (around 350 individual tests), and was quite proud of myself.

The unit tests are dividing to different test classes, each groups related tests together.

At some point I realised one of these test classes is getting quite large, and for ease of maintenance I decided to split it into several files, using the partial class approach, everything seemed to work ok – I kept the TestClass attribute on one file, and made all the other files partial, everything compiled and unit tests ran just fine.

Today I added a new unit test to one of these files, and for good 10 minutes I couldn’t realise why it does not appear in the test view list, until Oleg pointed out other tests in this file do not appear as well.

I’ve renamed the class, removed the partial keyword and added the TestClass attribute and the tests appeared (and ran) just fine.

Looks like a bug in VS, which does not consider test methods in partial class files, weird.

On the negative side – I had a bunch of test I never actually ran, and did not notice.

On the positive side – I now have 15 more tests running on my code!

Friday, October 01, 2010

Great news in my mailbox this evening

Somebody was working very hard at Microsoft, and is very punctual - it is exactly the 1st of October and the email arrived letting me know that my MVP status renewal has been approved for yet another year.

One thing I really like about the MVP programme (out of many) is the fact that it is up for renewal every year and that, despite what some may think, and to the best of my knowledge, MVPs really do have to prove themselves year after year.

I know I always get nervous towards October, worrying that I might just not make it this year, as I would hate to miss out on such an amazing opportunity, but somebody thought of me kindly yet another time, and I am humbled, and honoured.