asp.net mvc rhino mocks mocking httprequest values

Posted by Matthew on Stack Overflow See other posts from Stack Overflow or by Matthew
Published on 2010-07-07T13:30:29Z Indexed on 2011/01/05 9:53 UTC
Read the original article Hit count: 303

Filed under:
|
|

Hi Is there a way to mock request params, what is the best approach when testing to create fake request values in order to run a test

would some thing like this work?

        _context = MockRepository.GenerateStub<HttpContext>();
         request = MockRepository.GenerateStub<HttpRequest>();

        var collection = new NameValueCollection();
        collection.Add("", "");

        SetupResult.For(request.Params).Return(collection);
        SetupResult.For(_context.Request).Return(request);

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about rhino-mocks