TestDataObject Class

Definition

A wrapper class for XUnit test data that enables support for enumerating test cases in Test Explorer.

public class TestDataObject : Xunit.Abstractions.IXunitSerializable
type TestDataObject = class
    interface IXunitSerializable
Public Class TestDataObject
Implements IXunitSerializable
Inheritance
TestDataObject
Implements
Xunit.Abstractions.IXunitSerializable

Remarks

VS Test explorer only supports value types for data driven tests. This class implements Xunit.Abstractions.IXunitSerializable and serializes complex types as json so the test cases can be enumerated and displayed into VS test explorer. This also allows the developer to right click on a particular test case on VS Test explorer and run it individually.

Constructors

TestDataObject()

Initializes a new instance of the TestDataObject class.

TestDataObject(Object)

Initializes a new instance of the TestDataObject class.

Properties

TestObject

Gets a json string with the test data object.

Methods

Deserialize(IXunitSerializationInfo)

Used by XUnit.net for deserialization.

GetObject<T>()

Gets the test data object for the specified .Net type.

Serialize(IXunitSerializationInfo)

Used by XUnit.net for serialization.

Applies to