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:UsersAdministrator.nugetpackagesxunit.extensibility.core2.4.1lib
etstandard1.1xunit.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

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

原文地址:https://www.cnblogs.com/Tpf386/p/12190752.html