Class JsonValue
The matchers an assertion can hold a JSON scalar to.
public static class JsonValue
- Inheritance
-
JsonValue
- Inherited Members
Methods
Any()
Matches any value, null included.
public static IJsonValueMatcher Any()
Returns
Between<T>(T, T)
Matches a value within an inclusive range.
public static IJsonValueMatcher Between<T>(T minimum, T maximum) where T : IComparable
Parameters
minimumTmaximumT
Returns
Type Parameters
T
GreaterThanOrEqualTo<T>(T)
Matches a value at or above threshold; a null or incomparable value does not match.
public static IJsonValueMatcher GreaterThanOrEqualTo<T>(T threshold) where T : IComparable
Parameters
thresholdT
Returns
Type Parameters
T
GreaterThan<T>(T)
Matches a value above threshold; a null or incomparable value does not match.
public static IJsonValueMatcher GreaterThan<T>(T threshold) where T : IComparable
Parameters
thresholdT
Returns
Type Parameters
T
LessThanOrEqualTo<T>(T)
Matches a value at or below threshold; a null or incomparable value does not match.
public static IJsonValueMatcher LessThanOrEqualTo<T>(T threshold) where T : IComparable
Parameters
thresholdT
Returns
Type Parameters
T
LessThan<T>(T)
Matches a value below threshold; a null or incomparable value does not match.
public static IJsonValueMatcher LessThan<T>(T threshold) where T : IComparable
Parameters
thresholdT
Returns
Type Parameters
T
Matching(Predicate<object?>, string)
Matches a value the predicate accepts, phrased as
description on mismatch.
public static IJsonValueMatcher Matching(Predicate<object?> predicate, string description)
Parameters
Returns
NotNull()
Matches any value except null.
public static IJsonValueMatcher NotNull()
Returns
Null()
Matches a missing or explicit null.
public static IJsonValueMatcher Null()
Returns
OneOf<T>(params T[])
Matches a value equal to one of expected; numeric types may differ,
every other type must be compatible.
public static IJsonValueMatcher OneOf<T>(params T[] expected)
Parameters
expectedT[]
Returns
Type Parameters
T
Regex(string, RegexOptions)
Matches a string against a regular expression.
public static IJsonValueMatcher Regex(string pattern, RegexOptions options = RegexOptions.None)
Parameters
patternstringoptionsRegexOptions
Returns
StringContaining(string, StringComparison)
Matches a string containing expected.
public static IJsonValueMatcher StringContaining(string expected, StringComparison comparison = StringComparison.Ordinal)
Parameters
expectedstringcomparisonStringComparison
Returns
StringEndingWith(string, StringComparison)
Matches a string ending with expected.
public static IJsonValueMatcher StringEndingWith(string expected, StringComparison comparison = StringComparison.Ordinal)
Parameters
expectedstringcomparisonStringComparison
Returns
StringMatching(Predicate<string?>, string)
Matches a string the predicate accepts, phrased as
description on mismatch.
public static IJsonValueMatcher StringMatching(Predicate<string?> predicate, string description = "custom string condition")
Parameters
Returns
StringStartingWith(string, StringComparison)
Matches a string starting with expected.
public static IJsonValueMatcher StringStartingWith(string expected, StringComparison comparison = StringComparison.Ordinal)
Parameters
expectedstringcomparisonStringComparison