Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
別の関数 B を数回呼び出す関数 A があります。値に関係なく、正しい数の引数を持つ任意の数の呼び出しが固定値を返し、正しいものとして扱われるように、B をモックしたいと考えています。
関数が呼び出されるかどうか、またはその回数は仕様の一部ではありません。
B を通常どおりスタブアウトします。
B が 2 つの引数を受け入れ、'foo' を返す必要があると仮定します。
B(mox.IgnoreArg(), mox.IgnoreArg()).MultipleTimes().AndReturn('foo')
def B(*args, **kwds): return 'fixed value'