Table of Contents

Class UnitTest

Namespace
Acuit.Pinpoint.Services.Entities
Assembly
Acuit.Pinpoint.Services.Entities.dll

A unit test.

[DataContract(IsReference = true)]
[KnownType(typeof(TestType))]
[KnownType(typeof(UnitStation))]
[KnownType(typeof(Override))]
public class UnitTest
Inheritance
UnitTest
Inherited Members

Constructors

UnitTest(int, DateTime, TestType, UnitStation)

Initializes a new instance of the UnitTest class.

public UnitTest(int unitTestId, DateTime testDateTime, TestType testType, UnitStation unitStation)

Parameters

unitTestId int

The unique identifier for this unit test.

testDateTime DateTime

The date/time when this test was performed, in UTC.

testType TestType

The test type.

unitStation UnitStation

The unit station at which this occurred.

Exceptions

ArgumentNullException

testType is null.

ArgumentNullException

unitStation is null.

Properties

CustomTestData

Gets or sets the list of custom test data items. This can be null.

public IList<CustomTestDataItem>? CustomTestData { get; set; }

Property Value

IList<CustomTestDataItem>

Data

Gets optional custom data for this test, as XML.

[DataMember(Order = 2)]
public string? Data { get; set; }

Property Value

string

Notes

Gets or sets optional notes about this test.

[DataMember]
public string? Notes { get; set; }

Property Value

string

Override

Gets or sets the override for this test, if one exists.

[DataMember]
public Override? Override { get; set; }

Property Value

Override

Passed

Gets or sets whether this test passed.

[DataMember]
public bool Passed { get; set; }

Property Value

bool

Reason

Gets or sets the optional reason for a test not passing.

[DataMember]
public string? Reason { get; set; }

Property Value

string

TestDateTime

Gets the date/time when this test was performed, in UTC.

[DataMember]
public DateTime TestDateTime { get; }

Property Value

DateTime

TestType

Gets the test type.

[DataMember]
public TestType TestType { get; }

Property Value

TestType

UnitStation

Gets the unit station at which this occurred.

[DataMember]
public UnitStation UnitStation { get; }

Property Value

UnitStation

UnitTestId

Gets the unique identifier for this unit test.

[DataMember]
public int UnitTestId { get; }

Property Value

int

Methods

EncodeTestDataAsXml(IEnumerable<CustomTestDataItem>?)

Encodes test data as XML.

public static string? EncodeTestDataAsXml(IEnumerable<CustomTestDataItem>? testDataItems)

Parameters

testDataItems IEnumerable<CustomTestDataItem>

The test data items. This can be null.

Returns

string

The test data encoded as XML, or null if testDataItems is null or empty.

Remarks

See the remarks for ParseXmlTestData(string?) for details about the XML format.

MigrateXmlDataToCustomTestData()

Migrate the XML test data in the Data property to CustomTestData.

public void MigrateXmlDataToCustomTestData()

Remarks

If there is no XML test data (i.e., Data is null or the XML contains no child elements), then CustomTestData will not be changed. If there is any XML test data, then CustomTestData will be created if it was previously null, and then the test data will be added to the list. If this method is called multiple times, the test data will be copied multiple times.

See ParseXmlTestData(string?) for details about how the XML test data is parsed.

ParseXmlTestData(string?)

Parse XML test data.

public static IReadOnlyList<CustomTestDataItem> ParseXmlTestData(string? xmlTestData)

Parameters

xmlTestData string

The XML test data to parse. This can be null or empty.

Returns

IReadOnlyList<CustomTestDataItem>

A list of CustomTestDataItem objects representing the parsed test data. This will be an empty list if xmlTestData is null or empty.

Remarks

Each child element of the root XML element will become an item in the sequence. For each item, the element name will be used for Name (unless the "name" attribute is specified, as described below), the element's concatenated text content will be used for Value, and the following optional attributes of the element will be used as described below:

Attribute Description
name The name to use for Name. If specified, this will be used instead of the element name, which allows test data items to be given names that don't have to be valid XML element names.
status A status indication value to use for Status, which can be: None, Good, or Bad.
details Additional details to use for AdditionalDetails.