Class MatchResult
The result of Match.test().
Namespace: Amazon.CDK.Assertions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class MatchResult : DeputyBase
Syntax (vb)
Public Class MatchResult Inherits DeputyBase
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Assertions;
var target;
var matchResult = new MatchResult(target);
Synopsis
Constructors
| MatchResult(object) | The result of |
Properties
| FailCost | The cost of the failures so far. |
| FailCount | The number of failures. |
| IsSuccess | Whether the match is a success. |
| Target | The target for which this result was generated. |
Methods
| Compose(string, MatchResult) | Compose the results of a previous match as a subtree. |
| Finished() | Prepare the result to be analyzed. |
| HasFailed() | Does the result contain any failures. |
| Push(Matcher, string[], string) | (deprecated) DEPRECATED. |
| RecordCapture(IMatchCapture) | Record a capture against in this match result. |
| RecordFailure(IMatchFailure) | Record a new failure into this result at a specific path. |
| RenderMismatch() | Do a deep render of the match result, showing the structure mismatches in context. |
| ToHumanStrings() | Render the failed match in a presentable way. |
Constructors
MatchResult(object)
The result of Match.test().
public MatchResult(object target)
Parameters
- target object
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.Assertions;
var target;
var matchResult = new MatchResult(target);
Properties
FailCost
The cost of the failures so far.
public virtual double FailCost { get; }
Property Value
Remarks
ExampleMetadata: fixture=_generated
FailCount
The number of failures.
public virtual double FailCount { get; }
Property Value
Remarks
ExampleMetadata: fixture=_generated
IsSuccess
Whether the match is a success.
public virtual bool IsSuccess { get; }
Property Value
Remarks
ExampleMetadata: fixture=_generated
Target
The target for which this result was generated.
public virtual object Target { get; }
Property Value
Remarks
ExampleMetadata: fixture=_generated
Methods
Compose(string, MatchResult)
Compose the results of a previous match as a subtree.
public virtual MatchResult Compose(string id, MatchResult inner)
Parameters
- id string
the id of the parent tree.
- inner MatchResult
the id of the parent tree.
Returns
Remarks
ExampleMetadata: fixture=_generated
Finished()
Prepare the result to be analyzed.
public virtual MatchResult Finished()
Returns
Remarks
This API must be called prior to analyzing these results.
HasFailed()
Does the result contain any failures.
public virtual bool HasFailed()
Returns
Remarks
If not, the result is a success
Push(Matcher, string[], string)
(deprecated) DEPRECATED.
[Obsolete("use recordFailure()")]
public virtual MatchResult Push(Matcher matcher, string[] path, string message)
Parameters
Returns
Remarks
Stability: Deprecated
RecordCapture(IMatchCapture)
Record a capture against in this match result.
public virtual void RecordCapture(IMatchCapture options)
Parameters
- options IMatchCapture
Remarks
ExampleMetadata: fixture=_generated
RecordFailure(IMatchFailure)
Record a new failure into this result at a specific path.
public virtual MatchResult RecordFailure(IMatchFailure failure)
Parameters
- failure IMatchFailure
Returns
Remarks
ExampleMetadata: fixture=_generated
RenderMismatch()
Do a deep render of the match result, showing the structure mismatches in context.
public virtual string RenderMismatch()
Returns
Remarks
ExampleMetadata: fixture=_generated
ToHumanStrings()
Render the failed match in a presentable way.
public virtual string[] ToHumanStrings()
Returns
string[]
Remarks
Prefer using renderMismatch over this method. It is left for backwards
compatibility for test suites that expect it, but renderMismatch() will
produce better output.