.Net Extension Methods

Extension Methods – What are they?

They are methods written by you which allow you to extend classes that you cannot modify directly.  These might be classes you’re using from a third party DLL, or maybe you work in an organisation where your business objects are untouchable by a lowly developer such as yourself (and me), or maybe you just want to add some extra functionality to the String class.  If any of these situations ring true then extension methods are something you should know about. Continue reading

How to Unit Test a Private Method with MSTest

Okay so I’m not going to get into the debate about whether or not private methods should be unit tested as that’s not the purpose of this post (for what it’s worth I think they shouldn’t be tested), but as MSTest provides functionality to test private methods it makes sense that I should know how to set a test up for the occasion where a client wants me to write unit tests for private methods. Continue reading