开发者

Moq - Using VerifySet to check number of times called

开发者 https://www.devze.com 2023-01-09 06:12 出处:网络
I am trying to use VerifySet with Moq to check the number of times a setter on a collaborating Object i开发者_如何转开发s being called. But when I put in the Times portion of the call I get an error t

I am trying to use VerifySet with Moq to check the number of times a setter on a collaborating Object i开发者_如何转开发s being called. But when I put in the Times portion of the call I get an error that the assignment operator is not valid in an expression tree.

mockTimer.VerifySet(timer => timer.Prop = value); //Works fine
mockTimer.VerifySet(timer => timer.Prop = value, Times.Once); //Compile Error


You need to call the function Times.Once():

mockTimer.VerifySet(timer => timer.Prop = value, Times.Once()); 
0

精彩评论

暂无评论...
验证码 换一张
取 消