| View previous topic :: View next topic |
| Author |
Message |
rfennell Advanced

Joined: 13 Nov 2008 Posts: 16
|
Posted: Thu Nov 13, 2008 4:42 pm Post subject: Isolator inside ASP.NET pages |
|
|
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. |
|
| Back to top |
|
 |
gilz Site Admin

Joined: 12 Nov 2007 Posts: 298
|
Posted: Fri Nov 14, 2008 10:37 am Post subject: |
|
|
Hi Richard,
Let's take it offline. I sent a separate email regarding this issue.
Hoping to resolve this quickly, _________________ Gil Zilberfeld
Typemock Support Team |
|
| Back to top |
|
 |
Jo.Inter Newbie

Joined: 17 Nov 2008 Posts: 2
|
Posted: Mon Nov 17, 2008 9:48 am Post subject: |
|
|
Goodmoring,
I have the same problem.
Is it possible that you also send me that email? Or post it here?
Greetings |
|
| Back to top |
|
 |
ohad Site Admin

Joined: 18 May 2006 Posts: 617
|
Posted: Mon Nov 17, 2008 10:14 am Post subject: |
|
|
Hi
Sure we will update you as well. _________________ Regards
Ohad,
TypeMock Support Group |
|
| Back to top |
|
 |
ohad Site Admin

Joined: 18 May 2006 Posts: 617
|
Posted: Mon Nov 17, 2008 12:06 pm Post subject: |
|
|
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). _________________ Regards
Ohad,
TypeMock Support Group |
|
| Back to top |
|
 |
rfennell Advanced

Joined: 13 Nov 2008 Posts: 16
|
Posted: Mon Nov 17, 2008 1:55 pm Post subject: |
|
|
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' |
|
| Back to top |
|
 |
ohad Site Admin

Joined: 18 May 2006 Posts: 617
|
Posted: Tue Nov 18, 2008 3:59 pm Post subject: |
|
|
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. _________________ Regards
Ohad,
TypeMock Support Group |
|
| Back to top |
|
 |
ohad Site Admin

Joined: 18 May 2006 Posts: 617
|
Posted: Sun Nov 23, 2008 11:15 am Post subject: |
|
|
Hi
We created a patch and sent it.
Please check it out and tell me if it works. _________________ Regards
Ohad,
TypeMock Support Group |
|
| Back to top |
|
 |
Jo.Inter Newbie

Joined: 17 Nov 2008 Posts: 2
|
Posted: Mon Nov 24, 2008 6:58 am Post subject: |
|
|
Hi,
You're patch is working.
Great job. |
|
| Back to top |
|
 |
|