Documentation

Documentation
V5 Documentation

NCrunch.Framework.RestrictToStringAttribute

NCrunch.Framework Attribute Introduced NCrunch v5.0

Purpose

This attribute whether RDI should restrict calls to safe ToString methods for the associated test(s). It can be applied at assembly, fixture or test level.

This attribute overrides behaviour set by the Restrict ToString Usage To Avoid Side-Effects project-level configuration setting.

Declaration In NCrunch.Framework.dll

namespace NCrunch.Framework
{
    public class RestrictToStringAttribute: Attribute
    {
        public RestrictToStringAttribute(bool restrictToString)
        {
            Value = restrictToString;
        }

        public bool Value
        {
            get; private set;
        }
    }
}

You can declare this in your own code if you want NCrunch to use it - or otherwise reference the attribute from NCrunch.Framework.dll.

Usage example

[NCrunch.Framework.RestrictToString(false)]
[Test]
public void MyTest()
{
	...

Recommendations

For more information about ToString restrictions, refer to the Restrict ToString Usage To Avoid Side-Effects project-level configuration setting.

Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download