Class TestParameters
TestParameters class holds any named parameters supplied to the test run
Inherited Members
Namespace: NUnit.Framework
Assembly: nunit.framework.dll
Syntax
public class TestParameters
Constructors
View SourceTestParameters()
Declaration
public TestParameters()
Properties
View SourceCount
Gets the number of test parameters
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
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 |
Names
Gets a collection of the test parameter names
Declaration
public ICollection<string> Names { get; }
Property Value
| Type | Description |
|---|---|
| ICollection<string> |
Methods
View SourceExists(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 |
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 |
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 |
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 |