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
I have been looking a using Isolator AAA syntax for testing sharepoint and it has gone very well.

I have one questions, is it possible to create a fake such as

SPSite fakeSite = Isolate.Fake.Instance<SPSite>(Members.ReturnRecursiveFakes);

inside a ASP.NET web page's constructor. The reason I ask is I was wondering if I could use Isolator to mock out all the MOSS calls made by a webpart, thus allowing it to be run inside a simple ASP.NET web page. This would allow a quick means to check styling/layout.

When I tried it I got the error

Could not load file or assembly 'TypeMock, Version=0.21321.16725.21324, Culture=neutral, PublicKeyToken=545950454d4f434b' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

This is will TypeMock 5.1.1 installed in the GAC and also the assemblies in the web sites local directory. I know the installation is good as MSTEST can use Isolator based tests without any issue.

I suspect sandboxing issue in the Cassini web server, but the version number in the exception did seem a bit strange.
asked by rfennell (6.8k points)

8 Answers

0 votes
Hi Richard,

Let's take it offline. I sent a separate email regarding this issue.

Hoping to resolve this quickly,
answered by gilz (14.5k points)
0 votes
Goodmoring,

I have the same problem.
Is it possible that you also send me that email? Or post it here?

Greetings
answered by Jo.Inter (180 points)
0 votes
Hi

Sure we will update you as well.
answered by ohad (35.4k points)
0 votes
Hi

It is generally not a good idea to fake things from within your production code (page_load). Instead, you can fake the HTTPContext from inside your test (before initializing your web part to test it)

the reason is that the page_load could be called many times within one test by the ASP.NET runtime, and you only want to "fake" things once in your test.

You might want to take a look at Ivonna, which allows to easily test and fake web forms along with HTTPContext (built on top of Typemock Isolator).
answered by ohad (35.4k points)
0 votes
The only reason I was trying this was try to create a create a 'quick preview' of what a webpart will render as for addressing CSS style sheet etc. issues. This is a test harness where the testing tool is the designers eyes.

The reason for this is that the 'cost' in time to deploy webpart that calls Sharepoint is expensive and I thought to mock out the Sharepoint calls, but leave a 'real web server' to do the HTML /ajax rendering much be the answer. So it is not really production code. I would go as far to say as I doubt it would even be used to handle a post back, just a visual page inspection.

This all said Ivonna does look interesting, but I am not esure it addresses the question of 'are all the text boxes in line'
answered by rfennell (6.8k points)
0 votes
Hi

Now I see what you are trying to do.

The solution you sent reproduces the error you reported.
We are looking into it, I will update as soon as we will find something.
answered by ohad (35.4k points)
0 votes
Hi

We created a patch and sent it.
Please check it out and tell me if it works.
answered by ohad (35.4k points)
0 votes
Hi,

You're patch is working.

Great job.
answered by Jo.Inter (180 points)
...