returnStoredValueWhen
クラス: matlab.mock.TestCase
名前空間: matlab.mock
プロパティがアクセスされたときに格納された値を返す
構文
returnStoredValueWhen(testcase,behavior)
説明
入力引数
例
代替方法
returnStoredValueWhen メソッドの使用は、matlab.mock.actions.ReturnStoredValue アクションを PropertyGetBehavior クラスの when メソッドとあわせて使用するのと機能的には同じです。たとえば、次のコード ブロックは機能的に等価です。
% 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 で導入