Class MeterCaptureAssertions
- Namespace
- MetricsAssertions.TUnit
- Assembly
- MetricsAssertions.TUnit.dll
TUnit-native fluent Assert.That(meter).Has* assertions over a multi-instrument
MeterCapture, addressing one bundled instrument by name. Generated via the TUnit
[GenerateAssertion] source generator (AOT-clean).
public static class MeterCaptureAssertions
- Inheritance
-
MeterCaptureAssertions
- Inherited Members
Methods
HasCounterTotal(MeterCapture, string, long)
Asserts the net total of a bundled counter equals expected.
[GenerateAssertion]
public static AssertionResult HasCounterTotal(this MeterCapture value, string instrumentName, long expected)
Parameters
valueMeterCaptureThe meter capture.
instrumentNamestringThe counter instrument name.
expectedlongThe expected net total.
Returns
- AssertionResult
A passing assertion when the total matches; otherwise a failing one naming both values.
Exceptions
- ArgumentNullException
valueorinstrumentNameis null.
HasMeasurementCount(MeterCapture, string, int)
Asserts the measurement count for a bundled instrument equals expected.
[GenerateAssertion]
public static AssertionResult HasMeasurementCount(this MeterCapture value, string instrumentName, int expected)
Parameters
valueMeterCaptureThe meter capture.
instrumentNamestringThe instrument name.
expectedintThe expected measurement count.
Returns
- AssertionResult
A passing assertion when the count matches; otherwise a failing one naming both counts.
Exceptions
- ArgumentNullException
valueorinstrumentNameis null.
HasTaggedMeasurement(MeterCapture, string, string, object?)
Asserts a bundled instrument has at least one measurement tagged tagKey
equal to tagValue.
[GenerateAssertion]
public static AssertionResult HasTaggedMeasurement(this MeterCapture value, string instrumentName, string tagKey, object? tagValue)
Parameters
valueMeterCaptureThe meter capture.
instrumentNamestringThe instrument name.
tagKeystringThe tag key to match.
tagValueobjectThe tag value to match.
Returns
- AssertionResult
A passing assertion when a matching measurement exists; otherwise a failing one.
Exceptions
- ArgumentNullException
value,instrumentName, ortagKeyis null.
HasUpDownCounterValue(MeterCapture, string, long)
Asserts the net value of a bundled up-down counter equals expected.
[GenerateAssertion]
public static AssertionResult HasUpDownCounterValue(this MeterCapture value, string instrumentName, long expected)
Parameters
valueMeterCaptureThe meter capture.
instrumentNamestringThe up-down-counter instrument name.
expectedlongThe expected net value.
Returns
- AssertionResult
A passing assertion when the value matches; otherwise a failing one naming both values.
Exceptions
- ArgumentNullException
valueorinstrumentNameis null.