Class ProtoTestAttachment

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

A file or in-memory artifact associated with one test execution.

public sealed class ProtoTestAttachment
Inheritance
ProtoTestAttachment
Inherited Members
Extension Methods

Properties

Description

public string? Description { get; }

Property Value

string

FilePath

public string? FilePath { get; }

Property Value

string

IsFile

public bool IsFile { get; }

Property Value

bool

MediaType

public string MediaType { get; }

Property Value

string

Name

public string Name { get; }

Property Value

string

Methods

FromBytes(string, ReadOnlyMemory<byte>, string, string?)

public static ProtoTestAttachment FromBytes(string name, ReadOnlyMemory<byte> content, string mediaType = "application/octet-stream", string? description = null)

Parameters

name string
content ReadOnlyMemory<byte>
mediaType string
description string

Returns

ProtoTestAttachment

FromFile(string, string?, string, string?)

public static ProtoTestAttachment FromFile(string filePath, string? name = null, string mediaType = "application/octet-stream", string? description = null)

Parameters

filePath string
name string
mediaType string
description string

Returns

ProtoTestAttachment

FromText(string, string, string, string?)

public static ProtoTestAttachment FromText(string name, string content, string mediaType = "text/plain", string? description = null)

Parameters

name string
content string
mediaType string
description string

Returns

ProtoTestAttachment

MaterializeFileAsync(CancellationToken)

Returns the original file path or writes in-memory content to a durable temporary file.

public ValueTask<string> MaterializeFileAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<string>

ReadAllBytesAsync(CancellationToken)

public ValueTask<byte[]> ReadAllBytesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<byte[]>