matlab.mock.constraints.WasAccessed Class
Namespace: matlab.mock.constraints
Constraint determining property get access
Description
The WasAccessed
constraint produces a qualification
failure if an actual value is not a PropertyBehavior
instance,
or if the property that corresponds to the PropertyBehavior
was
not accessed the specified number of times.
The number of times a property is accessed includes the number of times that MATLAB® implicitly accesses the property. For example, if you display a mock object, MATLAB accesses the object properties to display their values.
Construction
constraint = WasAccessed
provides a constraint
that determines the property get access. If a property was accessed
at least once, the constraint is satisfied. To qualify that a property
was not accessed, negate the WasAccessed
constraint
with the tilde (~
) operator.
constraint = WasAccessed('WithCount',
provides
a constraint that is satisfied when a property was accessed exactly n
)n
times.
If you negate WasAccessed
with this syntax, if
the property was not accessed exactly n
times,
the constraint passes. For example, if a property was accessed 4 times, ~WasAccessed('WithCount',3)
passes
and ~WasAccessed('WithCount',4)
fails.
Input Arguments
Properties
Copy Semantics
Value. To learn how value classes affect copy operations, see Copying Objects.
Examples
Version History
Introduced in R2017a