returnStoredValueWhen
类: matlab.mock.TestCase
命名空间: matlab.mock
访问属性时返回所存储的值
语法
returnStoredValueWhen(testcase,behavior)
说明
输入参数
示例
备选方法
使用 returnStoredValueWhen 方法在功能上等同于对 PropertyGetBehavior 类的 when 方法使用 matlab.mock.actions.ReturnStoredValue 动作。例如,以下代码块在功能上是等效的。
% Using the returnStoredValueWhen method testCase.returnStoredValueWhen(get(behavior.PropertyFoo)); % Using the ReturnStoredValue action with the when function import matlab.mock.actions.ReturnStoredValue; when(get(behavior.PropertyFoo),ReturnStoredValue);
ReturnStoredValue 动作时,会有更多功能。例如,您可以为相同的模拟对象交互指定不同的后续行为。版本历史记录
在 R2017a 中推出