Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Make NCrunch's NuGet package support Portable Class Library
yanglee
#1 Posted : Friday, May 24, 2013 1:00:08 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/25/2012(UTC)
Posts: 89
Location: China

Thanks: 23 times
Was thanked: 19 time(s) in 18 post(s)
Hi,

NCrunch's official NuGet package does not support PCL (I workaround-ed this by coping the NCrunch.Framework.dll file from the package and creating my own NuGet package that support PCL).

The feature I want to use in PCL is: NCrunch.Framework.NCrunchEnvironment.NCrunchIsResident()

Although I can also use compiler constant like:

Code:
#if (NCRUNCH)

#endif


But that is less flexible and difficult to maintain (the compiler constant can be easily miss typed).

Cheers,
Yang
Remco
#2 Posted : Saturday, May 25, 2013 1:11:43 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks for reporting this one! I'll make sure it gets addressed with the compatibility improvements in V2.

Cheers,

Remco
yanglee
#3 Posted : Wednesday, May 29, 2013 6:58:21 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/25/2012(UTC)
Posts: 89
Location: China

Thanks: 23 times
Was thanked: 19 time(s) in 18 post(s)
Ah, just realized instead of creating my own Nuget package, I can add the following class in my project:

Code:
    public class TestEnvironment
    {
        public static bool IsTesting()
        {
#if (NUNIT || NCRUNCH)
            return true;
#else
            return false;
#endif
        } 
    }


And use it like this:

Code:
    if (TestEnvironment.IsTesting())
    {
        //
    }
    else
    {
        //
    }

1 user thanked yanglee for this useful post.
Remco on 5/29/2013(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.023 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download