Usage of Moq When(Func) method

前端 未结 2 1874
独厮守ぢ
独厮守ぢ 2021-02-11 22:01

I can\'t find an example of the usage of the When method in Moq

When(Func condition);

What is the purpose/usage of the method? Plea

2条回答
  •  情歌与酒
    2021-02-11 22:58

    With this method you can configure your mocked object's behavior when the condition set in Mock.When(...) evaluates to true. This enables your mocked object to react differently depending on the given condition.

提交回复
热议问题