Class TargetContractKit
- Namespace
- IntentSharp.Testing
- Assembly
- IntentSharp.dll
The adapter contract kit: runs the checks every ITarget must pass against a target and a script of one read, for the target's own tests. It needs no test framework: a failed check throws a TargetContractException naming the step, and a target that passes returns normally.
public static class TargetContractKit
- Inheritance
-
objectTargetContractKit
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()object.ReferenceEquals(object, object)object.ToString()
Remarks
The kit builds its own client: a ScriptedProvider that plans the script's command for every request, an
InMemoryDocumentStore, and one rule set written in code, contract, at the
Data checkpoint, which allows the described entities ("@described") on
data.entities, read on data.operations, and what ExtraSubjectValues
gives for the target's own subjects. No rule file is read and no model is called.
The steps, in order: describe, two descriptions of the unchanged target name the same entities with the same
kinds, operations, fields and field types (compared canonically; Properties and the
properties of entities and fields are not compared), and name every expected entity; run,
RunAsync(string, object?, CancellationToken) senses the target, plans the script's command, checks it and executes it once,
the inspection names exactly the expected entities, and at least ExpectedMinRecords
records come back; unchecked, TargetExecution has no public constructor, and a plan with no
command is refused by CheckAsync(CommandPlan, CancellationToken) as "nothing was checked" and never reaches the target's
ExecuteAsync(TargetExecution, CancellationToken).
Methods
- RunAsync(ITarget, TargetContractScript, CancellationToken)
Runs every step of the contract against
targetwithscript.