Table of Contents

Class TestParameters

Namespace
NUnit.Framework
Assembly
nunit.framework.dll

TestParameters class holds any named parameters supplied to the test run

public class TestParameters
Inheritance
TestParameters
Inherited Members

Constructors

TestParameters()

public TestParameters()

Properties

Count

Gets the number of test parameters

public int Count { get; }

Property Value

int

this[string]

Indexer provides access to the internal dictionary

public string? this[string name] { get; }

Parameters

name string

Name of the parameter

Property Value

string

Value of the parameter or null if not present

Names

Gets a collection of the test parameter names

public ICollection<string> Names { get; }

Property Value

ICollection<string>

Methods

Exists(string)

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

public bool Exists(string name)

Parameters

name string

Name of the parameter

Returns

bool

True if it exists, otherwise false

Get(string)

Get method is a simple alternative to the indexer

public string? Get(string name)

Parameters

name string

Name of the parameter

Returns

string

Value of the parameter or null if not present

Get(string, string?)

Get the value of a parameter or a default string

public string? Get(string name, string? defaultValue)

Parameters

name string

Name of the parameter

defaultValue string

Default value of the parameter

Returns

string

Value of the parameter or default value if not present

Get<T>(string, T)

Get the value of a parameter or return a default

public T Get<T>(string name, T defaultValue)

Parameters

name string

Name of the parameter

defaultValue T

Default value of the parameter

Returns

T

Value of the parameter or default value if not present

Type Parameters

T

The return Type