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> {

        [TestMethod]
        public void When_RedirectToHomePage_Should_Redirect_the_Response_to_HomePageUrl() {

            When.RedirectToHomePage();
            Should.Response.Redirect(Settings.HomePageUrl);
        }
    }

Production Code

    public class RouterController {

        public Response Response { get; set; }

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

    public interface Response {

        void Redirect(string url);
    }

Last edited Nov 5, 2008 at 7:02 AM by mikemps, version 2

Comments

No comments yet.