<PackageReference Include="NUnit" Version="3.4.0" />

TestResult

public abstract class TestResult : ITestResult, IXmlNodeBuilder
The TestResult class represents the result of a test.
protected int InternalAssertCount

Aggregate assertion count

ReaderWriterLock

public int AssertCount { get; }

Gets or sets the count of asserts executed when running the test.

public abstract IEnumerable<ITestResult> Children { get; }

Gets the collection of child results.

public double Duration { get; set; }

Gets or sets the elapsed time for running the test in seconds

public DateTime EndTime { get; set; }

Gets or sets the time the test finished running.

public abstract int FailCount { get; }

Gets the number of test cases that failed when running the test and all its children.

public virtual string FullName { get; }

Gets the full name of the test result

public abstract bool HasChildren { get; }

Indicates whether this result has any child results.

public abstract int InconclusiveCount { get; }

Gets the number of test cases that were inconclusive when running the test and all its children.

public string Message { get; }

Gets the message associated with a test failure or with not running the test

public virtual string Name { get; }

Gets the name of the test result

public string Output { get; }

Gets any text output written to this result.

public TextWriter OutWriter { get; }

Gets a TextWriter, which will write output to be included in the result.

public abstract int PassCount { get; }

Gets the number of test cases that passed when running the test and all its children.

public ResultState ResultState { get; }

Gets the ResultState of the test result, which indicates the success or failure of the test.

public abstract int SkipCount { get; }

Gets the number of test cases that were skipped when running the test and all its children.

public virtual string StackTrace { get; }

Gets any stacktrace associated with an error or failure.

public DateTime StartTime { get; set; }

Gets or sets the time the test started running.

public ITest Test { get; }

Gets the test with which this result is associated.

public TestResult(ITest test)

Construct a test result given a Test

public virtual TNode AddToXml(TNode parentNode, bool recursive)

Adds the XML representation of the result as a child of the supplied parent node..

public void RecordException(Exception ex)

Set the test result based on the type of exception thrown

public void RecordException(Exception ex, FailureSite site)

Set the test result based on the type of exception thrown

RecordTearDownException appends the message and stacktrace from an exception arising during teardown of the test to any previously recorded information, so that any earlier failure information is not lost. Note that calling Assert.Ignore, Assert.Inconclusive, etc. during teardown is treated as an error. If the current result represents a suite, it may show a teardown error even though all contained tests passed.

public void SetResult(ResultState resultState)

Set the result of the test

public void SetResult(ResultState resultState, string message)

Set the result of the test

public void SetResult(ResultState resultState, string message, string stackTrace)

Set the result of the test

public TNode ToXml(bool recursive)

Returns the Xml representation of the result.