Defining RedirectToHomePage in a RouterController

 Given a RouterController
 When RedirectToHomePage 
 Should Redirect the Response to HomePageUrl

Test Code

    [TestClass]
    public class Given_RouterController : BehaviorOf<RouterController> {

        readonly Response Response = TestObjectFor<Response>();

        [TestMethod]
        public void When_RedirectToHomePage_Should_Redirect_the_Response_to_HomePageUrl() {

            When.RedirectToHomePage(Response);
            Then.Should(Response).RedirectTo(Settings.HomePageUrl);
        }
    }

Production Code

    public class RouterController {

        public void RedirectToHomePage(Response Response) {
            Response.RedirectTo(Settings.HomePageUrl);
        }
    }

    public interface Response {

        void RedirectTo(string url);
    }

Last edited Nov 17, 2008 at 10:44 PM by mikemps, version 3

Comments

No comments yet.