Home Products Download Learn Buy Now Why Typemock? Support & Community About
Community > Forum
 FAQFAQ    SearchSearch   RegisterRegister   RssRss   ProfileProfile   Log inLog in 

Isolator inside ASP.NET pages

 
Post new topic   Reply to topic    Typemock Forum Index -> Unit Testing with Isolator (Previously called TypeMock)
View previous topic :: View next topic  
Author Message
rfennell
Advanced
Advanced


Joined: 13 Nov 2008
Posts: 19

PostPosted: Thu Nov 13, 2008 4:42 pm    Post subject: Isolator inside ASP.NET pages Reply with quote

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
View user's profile Send private message
gilz
Site Admin
Site Admin


Joined: 12 Nov 2007
Posts: 298

PostPosted: Fri Nov 14, 2008 10:37 am    Post subject: Reply with quote

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
View user's profile Send private message
Jo.Inter
Newbie
Newbie


Joined: 17 Nov 2008
Posts: 2

PostPosted: Mon Nov 17, 2008 9:48 am    Post subject: Reply with quote

Goodmoring,

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

Greetings
Back to top
View user's profile Send private message
ohad
Site Admin
Site Admin


Joined: 18 May 2006
Posts: 683

PostPosted: Mon Nov 17, 2008 10:14 am    Post subject: Reply with quote

Hi

Sure we will update you as well.
_________________
Regards

Ohad,
TypeMock Support Group
Back to top
View user's profile Send private message
ohad
Site Admin
Site Admin


Joined: 18 May 2006
Posts: 683

PostPosted: Mon Nov 17, 2008 12:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
rfennell
Advanced
Advanced


Joined: 13 Nov 2008
Posts: 19

PostPosted: Mon Nov 17, 2008 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
ohad
Site Admin
Site Admin


Joined: 18 May 2006
Posts: 683

PostPosted: Tue Nov 18, 2008 3:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
ohad
Site Admin
Site Admin


Joined: 18 May 2006
Posts: 683

PostPosted: Sun Nov 23, 2008 11:15 am    Post subject: Reply with quote

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
View user's profile Send private message
Jo.Inter
Newbie
Newbie


Joined: 17 Nov 2008
Posts: 2

PostPosted: Mon Nov 24, 2008 6:58 am    Post subject: Reply with quote

Hi,

You're patch is working.

Great job.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Typemock Forum Index -> Unit Testing with Isolator (Previously called TypeMock) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group