Tuesday 18 May 2010 at 12:18 pm
A colleague just came to me asking for advice on how to set the value of a referenced parameter with Moq; after nearly berating him for not checking Google I was surprised to find examples out there don't actually make it that obvious to the uninitiated.
For the purposes of this quick post I've created a dummy interface and associated method to mock, and then a quick method to test the mocked interface. This might seem long-winded but it's standard measure in our team to ensure it's firmly covered.
public interface ISomeThingToMock
{
void MockWithRefParam(int someOtherParam, StringBuilder stringBuilder);
}Let's show how a class might implement the interface:
public class SomeThingToMock : ISomeThingToMock
{
public void MockWithRefParam(int someOtherParam, StringBuilder stringBuilder) {
stringBuilder.Append("ThisWasNotMocked");
}
}Now I'm going to create a quick method that uses the above so our example is obvious:
Read More
Wednesday 21 April 2010 at 6:40 pm
What a fantastic ride the last 2.5 years have been since setting myself up as an independent consultant and contractor; despite the recession business has not only prospered but grown from strength to strength, especially in terms of opportunities to work with new technology.
Did we pass GO without noticing?
I confess to being so busy both 'catching up' and 'keeping up' with technological developments that I now wonder if I somehow missed a turning point in the willingness of the commercial sector to embrace new technologies, especially those emanating from the OSS stable.
Three years ago I found myself struggling to push through the most trivial design decisions such as using a home-baked build provider or using SQL Server 2005 notification services; however mention the words NHibernate, StructureMap, MVC, NUnit or Moq and you have people salivating at the prospect.
This newfound openness is not limited to technologies either; the attractiveness to both employer and employee of adopting methodologies like Scrum, and development practices such as DDD (Domain Driven Design), is palpable.
Along came Polly
Golden opportunities don't often come along but I was fortunate to find myself contracting with a company based in Oxfordshire who were about the embark on a massive migration to .NET, more excitingly their Technical Lead Rob Ashton was an avid support and contributor to OSS.
Read More