tags:

views:

473

answers:

3

I want to use the new Constraint-based model in NUnit. In which assembly and namespace are the classes defined? (Specificially, I'm looking for the "Is" class and the IConstraint implementations discussed in the documentaton). They do not seem to be in NUnit.Framework.

Also, I'm interested in v2.4.8, which as of this writing is the latest stable release.

+1  A: 

Works for me with NUnit.Framework on NUnit 2.5 Beta 2. From the code for 2.4.8, looks like it's in the same class.

namespace NUnit.Framework
{
    // Summary:
    //     The Assert class contains a collection of static methods that implement the
    //     most common assertions used in NUnit.
    public class Assert
    {
        public static void That(bool condition);
        public static void That(ActualValueDelegate del, IResolveConstraint expr);
        public static void That(bool condition, string message);
        public static void That(object actual, IResolveConstraint expression);
        public static void That<T>(ref T actual, IResolveConstraint constraint);
        public static void That(TestDelegate code, IResolveConstraint constraint);
        public static void That(ActualValueDelegate del, IResolveConstraint expr, string message);
        public static void That(bool condition, string message, params object[] args);
        public static void That(object actual, IResolveConstraint expression, string message);
        public static void That<T>(ref T actual, IResolveConstraint constraint, string message);
        public static void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args);
        public static void That(object actual, IResolveConstraint expression, string message, params object[] args);
        public static void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args);
    }
}

AssertionHelper is also in the same namespace.


For Is - try NUnit.Framework.SyntaxHelpers

Steven Lyons
Sorry, I should have been more clear. Assert and AssertionHandler are indeed in NUnit.Framework, but I'm looking for Is (the constraint helper) and the IConstraing implementations. I've edited my question to reflect this.
Craig Walker
+3  A: 

The IConstraint implementations are in NUnit.Framework.Constraints; I got this by checking the VS Intellisense for Assert.That(). I still don't see this actually documented anywhere on NUnit.

I'm still at a loss as to where Is is.

Craig Walker
+2  A: 

The Is class is in NUnit.Frameworks.SyntaxHandlers in nunit.framework.dll.

Craig Walker