Watson Jon

Code and ramblings from Watson
posts - 15, comments - 7, trackbacks - 0

My Links

News

Twitter












Archives

Post Categories

User Groups

October 2009 Entries

Injecting an array of objects with Unity
If you only have one implementation of a registered interface then it is pretty straight forward, but what do you do if you have multiple implementations of an interface? Now you have to get a little more explicit when registering items in your container. Let’s go through a simple example. Say you have a class, OrderProcessor, that takes one implementation of IMessageWriter: public class OrderProcessor { private readonly IMessageWriter _messageWriter; public OrderProcessor(IMessageWriter messageWriter)...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, October 19, 2009 10:56 PM | Feedback (1) |

It is hard to know when to move on
A post, possibly flame-bait, was sent out to a group that I subscribe. It was a response to a previous post about the “Duct Tape Programmer.” Incase you’re not familiar, it was started by a post from Joel Spolsky and taken to several extremes by way too many people. Anyway, the poster said something like this: “I used to idolize Joel Spolsky. However after reading his thoughts and listening to his podcast for the last couple of years I've come to realize he's an arrogant blowhard.” This made me pause...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Tuesday, October 06, 2009 9:42 PM | Feedback (2) |

Go ahead and repeat yourself
Did you know about the “Repeat” extension method? Enumerable.Repeat generates a sequence of repeated values – perfect for some testing scenarios. Here’s how I’ve used it… private static ISearchService CreateSearchServiceWithExpe... searchText, int ountOfResults) { var results = Enumerable.Repeat(new SearchResult { Id = searchText, Description = searchText, Title = searchText, Project = searchText }, countOfResults); return new MockSearchService(results.T... } This method takes...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, October 05, 2009 4:13 PM | Feedback (3) |

Powered by: