Class UnitTest
A unit test.
[DataContract(IsReference = true)]
[KnownType(typeof(TestType))]
[KnownType(typeof(UnitStation))]
[KnownType(typeof(Override))]
public class UnitTest : INotifyPropertyChanged
- Inheritance
-
UnitTest
- Implements
- Inherited Members
Properties
CustomTestData
Gets or sets custom test data collection.
[DataMember]
public ICollection<CustomTestDataItem> CustomTestData { get; set; }
Property Value
Data
Gets or sets custom data for this test.
[DataMember(Order = 2)]
public string Data { get; set; }
Property Value
IsDeserializing
Gets or sets whether this object is currently being deserialized.
protected bool IsDeserializing { get; }
Property Value
Notes
Gets or sets notes about this test.
[DataMember]
public string Notes { get; set; }
Property Value
Override
Gets or sets the override for this test, if one exists.
[DataMember]
public Override Override { get; set; }
Property Value
OverrideHasBeenIncluded
Gets or sets whether a navigation property has been included yet while getting an entity graph for a data model (to prevent doing so more than once).
public bool OverrideHasBeenIncluded { get; set; }
Property Value
Passed
Gets or sets whether this test passed.
[DataMember]
public bool Passed { get; set; }
Property Value
Reason
Gets or sets the reason for a test not passing.
[DataMember]
public string Reason { get; set; }
Property Value
TestDateTime
Gets or sets the date/time when this test was performed, in UTC.
[DataMember]
public DateTime TestDateTime { get; set; }
Property Value
TestType
Gets or sets the test type.
[DataMember]
public TestType TestType { get; set; }
Property Value
TestTypeHasBeenIncluded
Gets or sets whether a navigation property has been included yet while getting an entity graph for a data model (to prevent doing so more than once).
public bool TestTypeHasBeenIncluded { get; set; }
Property Value
UnitStation
Gets or sets the unit station at which this occurred.
[DataMember]
public UnitStation UnitStation { get; set; }
Property Value
UnitStationHasBeenIncluded
Gets or sets whether a navigation property has been included yet while getting an entity graph for a data model (to prevent doing so more than once).
public bool UnitStationHasBeenIncluded { get; set; }
Property Value
UnitTestId
Gets or sets the unique identifier for this unit test.
[DataMember]
public int UnitTestId { get; set; }
Property Value
Methods
EncodeTestDataAsXml(IEnumerable<CustomTestDataItem>)
Encodes test data as XML.
public static string EncodeTestDataAsXml(IEnumerable<CustomTestDataItem> testDataItems)
Parameters
testDataItems
IEnumerable<CustomTestDataItem>The test data items.
Returns
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 collection. 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.
OnPropertyChanged(string)
Processes property changes by raising the PropertyChanged event.
protected virtual void OnPropertyChanged(string propertyName)
Parameters
propertyName
stringThe name of the property that changed.
ParseXmlTestData(string)
Parse XML test data.
public static IEnumerable<CustomTestDataItem> ParseXmlTestData(string xmlTestData)
Parameters
xmlTestData
stringThe XML test data to parse.
Returns
- IEnumerable<CustomTestDataItem>
A sequence of CustomTestDataItem objects representing the test data, or an empty sequence if
xmlTestData
is null or empty or contains no elements.
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. |
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged