Implicitly having tests "decorated" as SilverlightUnitTest

May 24, 2010 at 6:49 AM

I am working on a cross-platform project and would really love to reuse my unit tests without having to have #if(SILVERLIGHT) and add the SilverlightUnitTestAttribute within its scope, or similar solution. 

Is there a way to implicitly have all tests be handled as Silverlight unit tests ?  Configuration file or programmatically so I can have a base class that sets it all up in the constructor or something.

 

Coordinator
May 24, 2010 at 10:29 AM
You can use a base class's setup and teardown to manually start and stop cthru with the silverlight aspects.
use reflector to look at the code for the silverlightunittestattriute
it is pretty simple.

for example:
init:


make sure you only call this once..

then you can call
or 
when you want to turn off silverlight faking (at the end of each test run perhaps).

do note, that turning on cthru for all tests may cause them to run much slower.


On Mon, May 24, 2010 at 9:49 AM, adept <notifications@codeplex.com> wrote:

From: adept

I am working on a cross-platform project and would really love to reuse my unit tests without having to have #if(SILVERLIGHT) and add the SilverlightUnitTestAttribute within its scope, or similar solution. 

Is there a way to implicitly have all tests be handled as Silverlight unit tests ?  Configuration file or programmatically so I can have a base class that sets it all up in the constructor or something.

 

Read the full discussion online.

To add a post to this discussion, reply to this email (CThru@discussions.codeplex.com)

To start a new discussion for this project, email CThru@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
Thanks,

Roy Osherove
www.TypeMock.com - Unit Testing, Plain Smart

Author of "The Art Of Unit Testing" (http://ArtOfUnitTesting.com )
A blog for team leaders: http://5Whys.com
my .NET blog: http://www.ISerializable.com
Twitter: http://twitter.com/RoyOsherove
+972-524-655388 (GMT+2)
May 26, 2010 at 12:42 PM

Thanks. 

I ended up with bigger fish to fry, as I had upgraded everything to VS2010 and latest version of TypeMock, but have recompiled CThru for that version now and everything seems to be working again. Now for refactoring my tests (maybe I should add some tests for the tests, so I don't break them.. :) )

 

Cheers,

Einar