Feature Suggestions

Make NCrunch's NuGet package support Portable Class Library

Started by yanglee on 7,137 views

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:

#if (NCRUNCH)

#endif


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

Cheers,
Yang

Edited

Thanks for reporting this one! I'll make sure it gets addressed with the compatibility improvements in V2.

Cheers,

Remco
Ah, just realized instead of creating my own Nuget package, I can add the following class in my project:

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


And use it like this:

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

Post a reply

Log in to reply.