chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

I was wondering if anyone knows why

MockObject mockHttpContext = MockManager.MockObject(typeof(System.Web.HttpContext), Constructor.Mocked);

is giving me an "object reference is not set to an instance of an object" error. It was working VS 2005, but started giving me the error when I switched to VS 2008 Beta 2. Any help would be greatly appreciated. Thanks.
asked by jp_wetzel (600 points)

3 Answers

0 votes
Hi,

Officially TypeMock does not yet support the VS 2008 beta platform.
However we are working on making it so.

We will check why you are getting such an error, and see if it can be quickly resolved.
answered by lior (13.2k points)
0 votes
Hi
Can you please post the full test code and mark the line that
throws the exception?
I checked it in Orcas and I didn't got the same results.
answered by ohad (35.4k points)
0 votes
Using natural mock I was able to mock

IHttpContext mockContext = RecorderManager.CreateMockedObject<IHttpContext>();

using (RecordExpectations recorder = RecorderManager.StartRecording())
{
recorder.ExpectAndReturn(_controller.Context, mockContext);
}

This worked for us.
answered by tshah (1.2k points)
...