While unit testing a WPF Caliburn application, I bumped into the following error:
The calling thread must be STA
and I ended up with a cross-thread exception. When diving into this problem I found that TestDriver.Net actually runs in STA (acronym for Singel Thread Apartment) by default, but NUnit is not! It is however a fairly simple configuration change to get NUnit running in STA. Add or update your app.config in your test project with following:
- Allot of hard work
- Leaving the old familiar Blogger tool
- Learning WordPress
- Trying to convert my old Feedburner readers to my new domain
- Making the shift without too much traffic loss
Luckily most of my traffic are from referring sites, so I guess with a little work and a couple of emails, I could redirect much of the traffic over to ISerialized.com. Beyond the statistical facts, what are my lessons learned from these last couple of days?!
Ever had the need to unit test a private method? Ever change a private method to public just to able to write a test for it? You are definitely not alone! A couple of weeks back I had a very interesting discussions with a very good colleague of mine: "What to do if I want to unit test a private method in C#". In this post I will show how you can use NUnit in combination with Reflection to unit test private methods!