Method AddAttachment
- Namespace
- Xunit
- Assembly
- xunit.v3.core.dll
AddAttachment(string, string)
Adds an attachment that is a string value.
public void AddAttachment(string name, string value)
Parameters
AddAttachment(string, string, bool)
Adds an attachment that is a string value.
public void AddAttachment(string name, string value, bool replaceExistingValue)
Parameters
namestringThe name of the attachment
valuestringThe value of the attachment
replaceExistingValueboolSet to
trueto allow an existing value to be replaced; set tofalseto throw an exception if an existing value already exists.
AddAttachment(string, byte[], string)
Adds an attachment that is a binary value (represented by a byte array and media type).
public void AddAttachment(string name, byte[] value, string mediaType = "application/octet-stream")
Parameters
namestringThe name of the attachment
valuebyte[]The value of the attachment
mediaTypestringThe media type of the attachment; defaults to "application/octet-stream"
Remarks
The mediaType value must be in the MIME "type/subtype" form, and does not support
parameter values. The subtype is allowed to have a single "+" to denote specialization of the
subtype (i.e., "application/xhtml+xml"). For more information on media types, see
https://datatracker.ietf.org/doc/html/rfc2045#section-5.1.
AddAttachment(string, byte[], bool, string)
Adds an attachment that is a binary value (represented by a byte array and media type).
public void AddAttachment(string name, byte[] value, bool replaceExistingValue, string mediaType = "application/octet-stream")
Parameters
namestringThe name of the attachment
valuebyte[]The value of the attachment
replaceExistingValueboolSet to
trueto allow an existing value to be replaced; set tofalseto throw an exception if an existing value already exists.mediaTypestringThe media type of the attachment; defaults to "application/octet-stream"
Remarks
The mediaType value must be in the MIME "type/subtype" form, and does not support
parameter values. The subtype is allowed to have a single "+" to denote specialization of the
subtype (i.e., "application/xhtml+xml"). For more information on media types, see
https://datatracker.ietf.org/doc/html/rfc2045#section-5.1.