Test-driven development in Javascript

Test-driven development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code toRead More

Unit testing ASP.NET Web API Controller

This post is about unit testing Web API controller. As we are using Entity Framework and some Web API related classes, we need to implement dependency injection to unit test Web API controllers. To manage Entity Framework dependency, I am using a simple Repository pattern. Here is my repository interface. As this post is moreRead More

Unit Testing Windows Phone Applications

Recently Microsoft released Update 2 for Visual Studio 2012. If you installed the Update 2, you will get a new project template, under Windows Phone, Windows Phone Unit Test App. This will help you to create unit test project for Windows Phone 8 applications. Once you create the project, necessary references will be added toRead More

How to return value based on condition in Moq

Today I while writing unit test for one class I got a problem, I have factory method, which will return values based on the input given, and I want to mock this method. I was using Moq for mocking. And I found a solution like this. Happy Programming

Web application testing using WatiN and C#

Today I got a chance to explore web application testing with WatiN library. You can download WatiN from website. Or you can install via NuGet, using following command. I am using VS Express 2012 for Web, for testing my web application. I am testing a Login page, where I got two textboxes for username andRead More

How to write an NUnit Addin

From version 2.2.x NUnit supports AddIns. Addins can customize NUnit’s internal behavior such as the creation of tests and their execution. An Addin should to implement the interface NUnit.Core.Extensibility.IAddin, which can be found in the assembly nunit.core.interfaces. Also the NUnit.Core.Extensibility.NUnitAddinAttribute must be applied to Addin class. The attribute parameters Name and Description represent the nameRead More