Class JSONConstraint
Constraint that compares two JSON sources with each other.
public class JSONConstraint : Constraint
- Inheritance
-
objectJSONConstraint
- Extension Methods
Constructors
JSONConstraint(object)
JSON comparison constraint
public JSONConstraint(object expectedValue)
Parameters
expectedValueobjectExpected value as string or JObject
Properties
Description
The Description of what this constraint tests, for use in messages and in the ConstraintResult.
public override string Description { get; }
Property Value
- string
Methods
ApplyTo<TActual>(TActual)
Tests whether the constraint is satisfied by a given value
public override ConstraintResult ApplyTo<TActual>(TActual actual)
Parameters
actualTActualThe value to be tested
Returns
- ConstraintResult
True for success, false for failure
Type Parameters
TActual
IsSimilarTo(JObject)
Creates JSONConstraint which compares the test-Object with the given JObject.
public static JSONConstraint IsSimilarTo(JObject expectedJObject)
Parameters
expectedJObjectJObject
Returns
IsSimilarTo(string)
Creates JSONConstraint which compares the test-Object with the given string.
public static JSONConstraint IsSimilarTo(string expectedJSON)
Parameters
expectedJSONstring