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
将测试标记为有超时,并获取或设置超时(以毫秒为单位)。
警告:在启用并行化的情况下使用此命令将导致未定义的行为。
仅在全局或禁用并行化的测试集合禁用并行化时才支持超时。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 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代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!