Attaches an XML-serialized object as an XML attachment with mime-type Xml
using the default XmlSerializer for the object's type.
Namespace:
Gallio.FrameworkAssembly: Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public static TextAttachment AttachObjectAsXml( string attachmentName, Object obj ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function AttachObjectAsXml ( _ attachmentName As String, _ obj As Object _ ) As TextAttachment |
Parameters
- attachmentName
- Type: System..::.String
The name of the attachment to create or null to automatically assign one. The attachment name must be unique within the scope of the currently executing test step.
- obj
- Type: System..::.Object
The object to serialize and embed, must not be null.
Return Value
The attachment.
Remarks
This is a convenience method that forwards the request to the current log writer as returned by the Writer property.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | Thrown if obj is null. |
| System..::.InvalidOperationException | Thrown if there is already an attachment with the same name. |
