Search Results for

    Show / Hide Table of Contents

    Class TestCaseAttribute

    Marks a method as a parameterized test suite and provides arguments for each test case.

    Inheritance
    object
    Attribute
    NUnitAttribute
    TestCaseAttribute
    TestCaseAttribute<T>
    TestCaseAttribute<T1, T2>
    TestCaseAttribute<T1, T2, T3>
    TestCaseAttribute<T1, T2, T3, T4>
    TestCaseAttribute<T1, T2, T3, T4, T5>
    Implements
    ITestBuilder
    ITestCaseData
    ITestData
    IImplyFixture
    Inherited Members
    Attribute.GetCustomAttributes(MemberInfo, Type)
    Attribute.GetCustomAttributes(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(MemberInfo)
    Attribute.GetCustomAttributes(MemberInfo, bool)
    Attribute.IsDefined(MemberInfo, Type)
    Attribute.IsDefined(MemberInfo, Type, bool)
    Attribute.GetCustomAttribute(MemberInfo, Type)
    Attribute.GetCustomAttribute(MemberInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo)
    Attribute.GetCustomAttributes(ParameterInfo, Type)
    Attribute.GetCustomAttributes(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(ParameterInfo, bool)
    Attribute.IsDefined(ParameterInfo, Type)
    Attribute.IsDefined(ParameterInfo, Type, bool)
    Attribute.GetCustomAttribute(ParameterInfo, Type)
    Attribute.GetCustomAttribute(ParameterInfo, Type, bool)
    Attribute.GetCustomAttributes(Module, Type)
    Attribute.GetCustomAttributes(Module)
    Attribute.GetCustomAttributes(Module, bool)
    Attribute.GetCustomAttributes(Module, Type, bool)
    Attribute.IsDefined(Module, Type)
    Attribute.IsDefined(Module, Type, bool)
    Attribute.GetCustomAttribute(Module, Type)
    Attribute.GetCustomAttribute(Module, Type, bool)
    Attribute.GetCustomAttributes(Assembly, Type)
    Attribute.GetCustomAttributes(Assembly, Type, bool)
    Attribute.GetCustomAttributes(Assembly)
    Attribute.GetCustomAttributes(Assembly, bool)
    Attribute.IsDefined(Assembly, Type)
    Attribute.IsDefined(Assembly, Type, bool)
    Attribute.GetCustomAttribute(Assembly, Type)
    Attribute.GetCustomAttribute(Assembly, Type, bool)
    Attribute.Equals(object)
    Attribute.GetHashCode()
    Attribute.Match(object)
    Attribute.IsDefaultAttribute()
    Attribute.TypeId
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: NUnit.Framework
    Assembly: nunit.framework.dll
    Syntax
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
    public class TestCaseAttribute : NUnitAttribute, ITestBuilder, ITestCaseData, ITestData, IImplyFixture

    Constructors

    View Source

    TestCaseAttribute(object?)

    Construct a TestCaseAttribute with a single argument

    Declaration
    public TestCaseAttribute(object? arg)
    Parameters
    Type Name Description
    object arg
    View Source

    TestCaseAttribute(object?, object?)

    Construct a TestCaseAttribute with a two arguments

    Declaration
    public TestCaseAttribute(object? arg1, object? arg2)
    Parameters
    Type Name Description
    object arg1
    object arg2
    View Source

    TestCaseAttribute(object?, object?, object?)

    Construct a TestCaseAttribute with a three arguments

    Declaration
    public TestCaseAttribute(object? arg1, object? arg2, object? arg3)
    Parameters
    Type Name Description
    object arg1
    object arg2
    object arg3
    View Source

    TestCaseAttribute(params object?[]?)

    Construct a TestCaseAttribute with a list of arguments. This constructor is not CLS-Compliant

    Declaration
    public TestCaseAttribute(params object?[]? arguments)
    Parameters
    Type Name Description
    object[] arguments

    Properties

    View Source

    Arguments

    Gets the list of arguments to a test case

    Declaration
    public object?[] Arguments { get; }
    Property Value
    Type Description
    object[]
    View Source

    Author

    The author of this test

    Declaration
    public string? Author { get; set; }
    Property Value
    Type Description
    string
    View Source

    Category

    Gets and sets the category for this test case. May be a comma-separated list of categories.

    Declaration
    public string? Category { get; set; }
    Property Value
    Type Description
    string
    View Source

    Description

    Gets or sets the description.

    Declaration
    public string? Description { get; set; }
    Property Value
    Type Description
    string

    The description.

    View Source

    ExcludePlatform

    Comma-delimited list of platforms to not run the test for

    Declaration
    public string? ExcludePlatform { get; set; }
    Property Value
    Type Description
    string
    View Source

    ExpectedResult

    Gets or sets the expected result.

    Declaration
    public object? ExpectedResult { get; set; }
    Property Value
    Type Description
    object

    The result.

    View Source

    Explicit

    Gets or sets a value indicating whether this TestCaseAttribute is explicit.

    Declaration
    public bool Explicit { get; set; }
    Property Value
    Type Description
    bool

    true if explicit; otherwise, false.

    View Source

    HasExpectedResult

    Returns true if the expected result has been set

    Declaration
    public bool HasExpectedResult { get; }
    Property Value
    Type Description
    bool
    View Source

    Ignore

    Gets or sets the reason for ignoring the test

    Declaration
    public string? Ignore { get; set; }
    Property Value
    Type Description
    string
    View Source

    IgnoreReason

    Gets or sets the ignore reason. When set to a non-null non-empty value, the test is marked as ignored.

    Declaration
    public string? IgnoreReason { get; set; }
    Property Value
    Type Description
    string

    The ignore reason.

    View Source

    IncludePlatform

    Comma-delimited list of platforms to run the test for

    Declaration
    public string? IncludePlatform { get; set; }
    Property Value
    Type Description
    string
    View Source

    Properties

    Gets the properties of the test case

    Declaration
    public IPropertyBag Properties { get; }
    Property Value
    Type Description
    IPropertyBag
    View Source

    Reason

    Gets or sets the reason for not running the test.

    Declaration
    public string? Reason { get; set; }
    Property Value
    Type Description
    string

    The reason.

    View Source

    RunState

    Gets or sets the RunState of this test case.

    Declaration
    public RunState RunState { get; }
    Property Value
    Type Description
    RunState
    View Source

    TestName

    Gets or sets the name of the test.

    Declaration
    public string? TestName { get; set; }
    Property Value
    Type Description
    string

    The name of the test.

    View Source

    TestOf

    The type that this test is testing

    Declaration
    public Type? TestOf { get; set; }
    Property Value
    Type Description
    Type
    View Source

    TypeArgs

    Get or set the type arguments for a generic test method. If not set explicitly, the generic types will be inferred based on the test case parameters.

    Declaration
    public Type[]? TypeArgs { get; set; }
    Property Value
    Type Description
    Type[]
    View Source

    Until

    Gets and sets the ignore until date for this test case.

    Declaration
    public string? Until { get; set; }
    Property Value
    Type Description
    string

    Methods

    View Source

    BuildFrom(IMethodInfo, Test?)

    Builds a single test from the specified method and context.

    Declaration
    public IEnumerable<TestMethod> BuildFrom(IMethodInfo method, Test? suite)
    Parameters
    Type Name Description
    IMethodInfo method

    The MethodInfo for which tests are to be constructed.

    Test suite

    The suite to which the tests will be added.

    Returns
    Type Description
    IEnumerable<TestMethod>

    Implements

    ITestBuilder
    ITestCaseData
    ITestData
    IImplyFixture
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0