Performing and Testing Redirects with ASP.NET Web Forms MVP

added by webpoet
4/5/2010 6:24:38 AM


The ASP.NET Web Forms MVP project helps us build more testable web sites. One of the hardest things to (unit) test when using ASP.NET Web Forms has traditionally been redirects as they are performed on the Http Context. When we use Web Forms MVP, which uses the HttpContextBase class, we can, with the help of test doubles quite easily test redirects. In this tutorial I show two ways to implement a unit test for a presenter method that performs a redirect when a condition has been met.