Newbie question on MvcContrib TestHelpers
        Posted  
        
            by Simon Lomax
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Simon Lomax
        
        
        
        Published on 2010-05-28T12:50:07Z
        Indexed on 
            2010/05/28
            12:51 UTC
        
        
        Read the original article
        Hit count: 291
        
Hi,
I'm just starting to use the TestHelpers in MvcContrib. I want to try and test an action method on my controller that itself tests if IsAjaxRequest() is true.
I've used the same code that is shown in the TestHelper samples to set up the TestControllerBuilder
_controller = new StarsController();    
_builder = new TestControllerBuilder();
_builder.InitializeController(_controller);
So that _controller has all the faked/mocked HttpContext inside it, which is really great. But what do I do now to force IsAjaxRequest() on the internally faked Request object to return true?
© Stack Overflow or respective owner