Wednesday, February 16, 2011

Moq Setting local variable using callbacks.

http://code.google.com/p/moq/wiki/QuickStart


// Set up the mock:

AgentLoginParams passedObject = null;

moduleMock.Setup(mm=>mm.Login(It.IsAny())).Callback(alp=> passedObject = alp);

// Do something you’re testing

controller.Login(station, userName, password);

// Assert that something was called with the correct data

Assert.IsNotNull(passedObject);

Assert.AreEqual(userName,passedObject.UserName);

Monday, February 7, 2011

TFS Task Control/App

Found by a coworker..

In trying to figure out an easier way to keep track of my tasks in TFS, I stumbled across this FREE tool from Telerik (registration required, or you can rename the attached file to an MSI, and install). It is a stand-alone app that connects to the TFS server, and provides a way to keep an eye on your tasks outside of Visual Studio. It also provides a task board, supports Sprint Planning with your team, and much more. It is used internally by Telerik as part of their AGILE shop, and is geared towards that.

For me, I can keep this open to monitor my tasks and untether myself from Visual Studio. This makes it easier as I have multiple instances of VS open at a time, and when I close one, sometimes lose all my tasks/query tabs, etc.

Basic query view:

Wednesday, February 2, 2011

WCF Faults and Exceptions

Having spent the whole day trying to send exception information back up to the client....

Make it easy on yourself and do not include the Exception class as a property of the FaultException class. But if you do look at the links below.


How to impliment the IErrorHandler
http://codeidol.com/csharp/wcf/Faults/Error-Handling-Extensions/

How to make Exception class serialize using IErrorHandler:
http://www.woutware.com/blog/?tag=/faultexception