Search Results for

    Show / Hide Table of Contents

    Class TestParameters

    TestParameters class holds any named parameters supplied to the test run

    Inheritance
    object
    TestParameters
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: NUnit.Framework
    Assembly: nunit.framework.dll
    Syntax
    public class TestParameters

    Constructors

    View Source

    TestParameters()

    Declaration
    public TestParameters()

    Properties

    View Source

    Count

    Gets the number of test parameters

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

    this[string]

    Indexer provides access to the internal dictionary

    Declaration
    public string? this[string name] { get; }
    Parameters
    Type Name Description
    string name

    Name of the parameter

    Property Value
    Type Description
    string

    Value of the parameter or null if not present

    View Source

    Names

    Gets a collection of the test parameter names

    Declaration
    public ICollection<string> Names { get; }
    Property Value
    Type Description
    ICollection<string>

    Methods

    View Source

    Exists(string)

    Gets a flag indicating whether a parameter with the specified name exists.

    Declaration
    public bool Exists(string name)
    Parameters
    Type Name Description
    string name

    Name of the parameter

    Returns
    Type Description
    bool

    True if it exists, otherwise false

    View Source

    Get(string)

    Get method is a simple alternative to the indexer

    Declaration
    public string? Get(string name)
    Parameters
    Type Name Description
    string name

    Name of the parameter

    Returns
    Type Description
    string

    Value of the parameter or null if not present

    View Source

    Get(string, string?)

    Get the value of a parameter or a default string

    Declaration
    public string? Get(string name, string? defaultValue)
    Parameters
    Type Name Description
    string name

    Name of the parameter

    string defaultValue

    Default value of the parameter

    Returns
    Type Description
    string

    Value of the parameter or default value if not present

    View Source

    Get<T>(string, T)

    Get the value of a parameter or return a default

    Declaration
    public T Get<T>(string name, T defaultValue)
    Parameters
    Type Name Description
    string name

    Name of the parameter

    T defaultValue

    Default value of the parameter

    Returns
    Type Description
    T

    Value of the parameter or default value if not present

    Type Parameters
    Name Description
    T

    The return Type

    • 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