The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog. Here’s an excerpt: 4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 21,000 views in 2012. If each view were a film, this blog would power 5 Film Festivals Click here to see the complete report. Continue reading 2012 in review
In the first part of this article I showed how I’ve been testing code using MEF and a generic base class that is in charge of wiring up the dependencies.
In this part I will focus on how I got WCF to wire up my web service using MEF in what I think is quite an elegant way.
My first requirement was to be able to write a web service that will use dependencies (imports) but that wouldn’t require me to write the composition code in the service class itself. Most of the examples I saw online didn’t provide me with a good way to do that unfortunately.
Until I came across this excellent post by Tim Roberts which shows how to tap into the WCF pipe-line and have your services composed automatically instead of having to do it per service or including wire-up code in your classes.
While the code Tim provided was a great start I thought it wasn’t just right for me. Specifically it was the fact that it required custom code in the Global.asax file which for me was not as elegant as it should be.
So I’ve done a bit more digging into the WCF pipe-line and discovered that I could achieve an elegant, completely configuration-based solution by implementing my own endpoint behavior.
In the end I needed to only create 3 classes to achieve this: EndpointComposedElement, ComposedEndpointBehavior and ComposedInstanceProvider.
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.
This year LivePerson (the company I work for) is doing a fund-raising trek in Snowdonia (yes its really called that way) in order to raise funds for Naomi House & Jacks Place which is a phenomenal hospice dedicated to help children and young adults in need. These kids are usually faced with conditions and illnesses that mean they are likely not going to make it to adulthood.
LivePerson UK is heavily involved with Naomi House and has been working with the hospice for several years to raise money and volunteer to help make it a better place.
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:
I am very happy to announce that today I’m officially making my project named ImportanTweet available on the web!
The idea behind ImportantTweet is to show the tweets that are important to you so if you follow a considerable number of accounts on Twitter and it becomes difficult to keep track and you feel like you miss on tweets you find interesting, IT is the tool for you.
Three weeks ago I wanted to buy a present for my beautiful wife for having carried our recently born baby girl, she did it magnificently for over 9 months and I thought that a small token would be the least I can do to show my appreciation for bringing an amazing present into our lives.
I looked online and found a pair of very nice white-gold earrings that I had hoped she will like on Overstock.com, a site I had heard good things about and thought is a reputable brand that I could trust. The fact that they had online chat on their site bolstered that feeling as I’m a LivePerson employee I can now recognize and appreciate the value of live chat on a retail site. Overstock is not a LivePerson customer by the way (perhaps that should have tipped me off).
I have ordered the earrings on December 23rd, 2011 and of course I knew they will take some time to arrive, after all it was just before Christmas but that was fine with me, I had hoped they will arrive a few days after the new year.
After they did not arrive for a while I looked at the confirmation email I received and used the tracking link they provided, this took me to the DHL tracking site which very “usefully” told me it couldn’t find the details for the tracking number. I thought to myself, alright, I will try in a few more days, surely it will appear soon.