This article will focus on how I’ve adopted unit testing in .NET using MEF and how to also apply this to WCF web services.
I haven’t been dedicated to unit testing for a long time but once I started I couldn’t stop. There are many great benefits to doing unit tests, I wont list them here but a good article to read is at: Agitar.com
What made me build something on my own? I wanted something light that I could also integrate into existing code without making too many changes. So I focused on a couple of things: Testing and Dependency Injection. I wanted an elegant solution that didn’t rely on external libraries or that will require a steep learning-curve.
In this article I will focus on these topics and how I solved it for myself. I’m not going to dive into other topics such as The SOLID principals, TDD, Dependency Injection, Mocking, etc. If these terms are not familiar to you, I suggest you read up on them first.
I’m actually going to divide this article into two parts, to keep them shorter and to the point:
- This first part will discuss how to do testing with MEF.
- The second will discuss how to use MEF and test for a WCF service.
Today I’ve released the second version of ImportanTweet.com.
The site was first released about a couple of weeks ago in a very limited, invite only mode and a few lucky participants have gotten to use it and I have received some excellent feedback that to the greater part I’ve managed to incorporate in this release. Others will be added later as well as more features and improvements I already have in mind.
Let me start by saying that your feedback is crucial for the site to succeed so please keep it coming in any form you can. I can be contacted here through comments, on Twitter at @important_t_com and by email.
This new release is packed with new features, improvements and some bug fixes. Below is a list of the major ones to notice:
In many occurrences i find myself wanting to fade in an element on the page and then immediately fade it out as a way to convey that something happened in a non-obtrusive way.
To do that I need to call the fadeIn and fadeOut jQuery methods in sequence. This can be done easily because fadeIn accepts a callback as a second parameter which will be called when the animation completes.
Easy as it is to do I still find it annoying that i have to call two separate methods for an action i wish to be done as one so naturally since it is so easy to extend jQuery I wrote a little extension that does just that.