Class Matcher
Represents a matcher that can perform special data matching capabilities between a given pattern and a target.
Namespace: Amazon.CDK.Assertions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class Matcher : DeputyBase
Syntax (vb)
Public MustInherit Class Matcher
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// Given a template -
// {
// "Resources": {
// "MyBar": {
// "Type": "Foo::Bar",
// "Properties": {
// "Fred": {
// "Wobble": ["Flob", "Flib"],
// }
// }
// }
// }
// }
// The following will NOT throw an assertion error
template.HasResourceProperties("Foo::Bar", new Dictionary<string, IDictionary<string, Matcher[]>> {
{ "Fred", new Struct {
Wobble = new [] { Match.AnyValue(), Match.AnyValue() }
} }
});
// The following will throw an assertion error
template.HasResourceProperties("Foo::Bar", new Dictionary<string, IDictionary<string, Matcher>> {
{ "Fred", new Struct {
Wimble = Match.AnyValue()
} }
});
Synopsis
Constructors
Matcher() | |
Matcher(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Matcher(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Name | A name for the matcher. |
Methods
IsMatcher(Object) | Check whether the provided object is a subtype of the |
Test(Object) | Test whether a target matches the provided pattern. |
Constructors
Matcher()
protected Matcher()
Matcher(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Matcher(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Matcher(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Matcher(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Name
A name for the matcher.
public abstract string Name { get; }
Property Value
System.String
Remarks
This is collected as part of the result and may be presented to the user.
Methods
IsMatcher(Object)
Check whether the provided object is a subtype of the IMatcher
.
public static bool IsMatcher(object x)
Parameters
- x System.Object
Returns
System.Boolean
Test(Object)
Test whether a target matches the provided pattern.
public abstract MatchResult Test(object actual)
Parameters
- actual System.Object
the target to match.
Returns
the list of match failures. An empty array denotes a successful match.
Remarks
Every Matcher must implement this method. This method will be invoked by the assertions framework. Do not call this method directly.