Table of Contents

Class TestAttachment

Namespace
Xunit.Sdk
Assembly
xunit.v3.common.dll

Represents an attachment to a test result.

public class TestAttachment
Inheritance
TestAttachment
Inherited Members

Constructors

TestAttachment()

Called by the de-serializer; should only be called by deriving classes for de-serialization purposes

Properties

AttachmentType

Gets the type of the test attachment.

Methods

AsByteArray()

Gets the attachment content as a byte array, along with the media type. Can only be called when AttachmentType returns ByteArray.

AsString()

Gets the attachment content as a string. Can only be called when AttachmentType returns String.

Create(byte[], string)

Creates an instance of TestAttachment that wraps a byte array value.

Create(string)

Creates an instance of TestAttachment that wraps a string value.

Parse(string)

Parses a value that was obtained by calling ToString() back into a TestAttachment.

ToString()

Gets a string value for the test attachment. For string value attachments, will return the string value; for byte array values, it will return the base-64 encoded value of the bytes.