Table of Contents

Class JSONConstraint

Namespace
CMS.Tests
Assembly
CMS.Tests.dll

Constraint that compares two JSON sources with each other.

public class JSONConstraint : Constraint
Inheritance
object
JSONConstraint
Extension Methods

Constructors

JSONConstraint(object)

JSON comparison constraint

public JSONConstraint(object expectedValue)

Parameters

expectedValue object

Expected 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

actual TActual

The 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

expectedJObject JObject

Returns

JSONConstraint

IsSimilarTo(string)

Creates JSONConstraint which compares the test-Object with the given string.

public static JSONConstraint IsSimilarTo(string expectedJSON)

Parameters

expectedJSON string

Returns

JSONConstraint