NUnit 约束模型的程序集和命名空间

发布于 2024-07-16 02:32:56 字数 265 浏览 4 评论 0原文

我想在 NUnit 中使用新的基于约束的模型 。 类是在哪个程序集和命名空间中定义的? (具体来说,我正在寻找文档中讨论的“Is”类和 IConstraint 实现)。 它们似乎不在 NUnit.Framework 中。

另外,我对 v2.4.8 很感兴趣,在撰写本文时它是最新的稳定版本。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冷︶言冷语的世界 2024-07-23 02:32:56

IConstraint 实现位于 NUnit.Framework.Constraints 中; 我通过检查 VS Intellisense 的 Assert.That() 得到了这个。 我仍然没有看到 NUnit 上任何地方实际记录了这一点。

我仍然不知道 Is 在哪里。

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.

年少掌心 2024-07-23 02:32:56

Is 类位于 nunit.framework.dll 的 NUnit.Frameworks.SyntaxHandlers 中。

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

一萌ing 2024-07-23 02:32:56

适用于 NUnit 2.5 Beta 2 上的 NUnit.Framework。从 2.4.8 的代码来看,它看起来像是在同一个类中。

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 - 尝试 NUnit.Framework.SyntaxHelpers

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文