Class ProtoCoverageCollector

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Thread-safe base for collectors that aggregate observations as coverage items.

public abstract class ProtoCoverageCollector : IProtoCollector, IProtoReportSource
Inheritance
ProtoCoverageCollector
Implements
Derived
Inherited Members
Extension Methods

Constructors

ProtoCoverageCollector(string)

Creates a collector for one target, accepting every observation kind it sees.

protected ProtoCoverageCollector(string targetName)

Parameters

targetName string

ProtoCoverageCollector(string, string?, StringComparer?)

Creates a collector for one target and, when kind is given, one observation kind. identifierComparer chooses whether identifiers are case-sensitive: GraphQL operation names are, most coverage identifiers are not.

protected ProtoCoverageCollector(string targetName, string? kind, StringComparer? identifierComparer = null)

Parameters

targetName string
kind string
identifierComparer StringComparer

Fields

_items

protected readonly Dictionary<string, ProtoReportItem> _items

Field Value

Dictionary<string, ProtoReportItem>

_lock

protected readonly object _lock

Field Value

object

Properties

Category

public abstract string Category { get; }

Property Value

string

TargetName

public string TargetName { get; }

Property Value

string

Methods

CanCollect(ProtoObservation)

Determines whether this collector accepts an observation.

public virtual bool CanCollect(ProtoObservation observation)

Parameters

observation ProtoObservation

Returns

bool

Collect(ProtoObservation)

Records an incoming observation. Implementations should support concurrent calls when tests or requests execute in parallel.

public virtual void Collect(ProtoObservation observation)

Parameters

observation ProtoObservation

GetReportItems()

public virtual IEnumerable<ProtoReportItem> GetReportItems()

Returns

IEnumerable<ProtoReportItem>

MergeMetadata(IReadOnlyDictionary<string, object>?, IReadOnlyDictionary<string, object>?)

protected static IReadOnlyDictionary<string, object>? MergeMetadata(IReadOnlyDictionary<string, object>? existing, IReadOnlyDictionary<string, object>? incoming)

Parameters

existing IReadOnlyDictionary<string, object>
incoming IReadOnlyDictionary<string, object>

Returns

IReadOnlyDictionary<string, object>