Xunit--FactAttribute特性

 

 

Attribute that is applied to a method to indicate that it is a fact that should
// be run by the test runner. It can also be extended to support a customized definition
// of a test method.


应用于方法的属性,指示该事实是应该,由测试跑步者运行。 也可以扩展以支持自定义定义测试方法。

复制代码
#region 程序集 xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c
// C:\Users\Administrator\.nuget\packages\xunit.extensibility.core\2.4.1\lib\netstandard1.1\xunit.core.dll
#endregion

using System;
using Xunit.Sdk;

namespace Xunit
{
    //
    // 摘要:
    //     Attribute that is applied to a method to indicate that it is a fact that should
    //     be run by the test runner. It can also be extended to support a customized definition
    //     of a test method.
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    [XunitTestCaseDiscoverer("Xunit.Sdk.FactDiscoverer", "xunit.execution.{Platform}")]
    public class FactAttribute : Attribute
    {
        public FactAttribute();

        //
        // 摘要:
        //     Gets the name of the test to be used when the test is skipped. Defaults to null,
        //     which will cause the fully qualified test name to be used.
        public virtual string DisplayName { get; set; }
        //
        // 摘要:
        //     Marks the test so that it will not be run, and gets or sets the skip reason
        public virtual string Skip { get; set; }
        //
        // 摘要:
        //     Marks the test as having a timeout, and gets or sets the timeout (in milliseconds).
        //     WARNING: Using this with parallelization turned on will result in undefined behavior.
        //     Timeout is only supported when parallelization is disabled, either globally or
        //     with a parallelization-disabled test collection.
        public virtual int Timeout { get; set; }
    }
}
复制代码


DisplayName

 获取跳过测试时要使用的测试的名称。 默认为空,
 这将导致使用完全合格的测试名称。

skip

标记测试,使其不会运行,并获取或设置跳过原因

Timeout

将测试标记为有超时,并获取或设置超时(以毫秒为单位)。
警告:在启用并行化的情况下使用此命令将导致未定义的行为。
仅在全局或禁用并行化的测试集合禁用并行化时才支持超时。

 

posted on   荆棘人  阅读(804)  评论(0编辑  收藏  举报

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示