Archive for the 'unit testing' Category

Enable https on ASP.NET MVC 2 & 3, through Filters and web.config

Tuesday, July 26th, 2011

To enable SSL on asp.net mvc, one can use the [RequireHttps] attribute on the base controller if you are using a base controller ?View Code CSHARP1 2 [RequireHttps] public class BaseController: Controller But what if you want to give an option to the installer or the client to enable it in web.config, the easy way [...]

Share

Ottawa IT Code Camp – Unit Testing with Mocking Framework

Saturday, April 16th, 2011

Thanks to everyone who came to the code camp today, I will get those Typemock license to the 2 winners. Here is the code if anyone is interested https://github.com/taswar/Ottawa-IT-Code-Camp-Unit-Testing-with-Mocking-Framework Here is the presentation. Mocking a Unit Test Story on Prezi

Share

Stubbing out ServiceLocator for unit testing

Wednesday, June 30th, 2010

There are certainly many ways to stub out dependency, using constructor injection, etc etc. Here is one way to quickly stub out ServiceLocator rather than implementing ServiceLocatorStub. Lets say you have code that uses a helper and the dependency is not quite the responsibility of that object but its the sub object that uses it. [...]

Share

Learn The Sprout Method for adding new functionality

Monday, August 31st, 2009

In this Learn Series I am going to write about the Sprout Method which is in the book “Working Effectively with Legacy Code by Michael Feathers“, all I have to say is what a great book if you don’t have it, you should pick it up asap. Sprout Method is a technique that one can [...]

Share

Extract and Override refactoring technique part 2

Friday, April 17th, 2009

This is part 2 of Extract and Override technique. You can find part 1 in my previous post. I am going to show another technique by using Factory Method to break dependency in your code. *WARNING* *WARNING* Before I begin I would like to say all these techniques are not the best design but they [...]

Share

Extract and Override refactoring technique

Sunday, March 8th, 2009

When doing unit testing, one always comes to a point where there this “kind of hard” part to test since the part depends on something you might not have control over or depends on the functionality of the dependency to complete. In “Working Effectively with Legacy Code” by Michael C. Feathers talks about a dependency [...]

Share