How to stub HttpRequestBase to return cookies?

79 views
Skip to first unread message

Scott McFadden

unread,
Jan 2, 2015, 8:08:03 PM1/2/15
to rhino...@googlegroups.com
How do you stub HttpRequestBase to return cookies?  I get NotSupportedException when running test.

 var cookies = new HttpCookieCollection();
            
 var request = MockRepository.GenerateStub<HttpRequestBase>();
            
 request.Stub(x => x.Cookies).Return(cookies);  //NotSupportedException - Can't create mocks of sealed classes

.NET 3.51
RhinoMocks 3.61


           

Reginald Blue

unread,
Jan 5, 2015, 8:45:55 AM1/5/15
to rhino...@googlegroups.com

There must be something strange in your project. I just tried the exact same thing and it worked perfectly.

It was. Net 4.0 RhinoMocks 3.6, but that shouldn't matter. Start a blank project and try again.

--
You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhinomocks+...@googlegroups.com.
To post to this group, send email to rhino...@googlegroups.com.
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages