Site Loader
Auckland, New Zealand
In the last post of this Moq series, we were discussing how to set a return value for a method, so that we can test our intended method for its behaviour. In this post, we will discuss how to leverage the power of Moq to test the number of times a method being called. This feature is very handy while we check if the intended operation is really happening. Here is the complete video of the above discussion Here is the complete code of the above video.
            var moqPersonalDetail = new Mock();

            var pfDetail = new EmpPfDetails(moqPersonalDetail.Object);


            moqPersonalDetail.Verify(x => x.GetEmployeeSalary(It.IsAny()), Times.Exactly(1));
Thanks for reading the post and watching the video!!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

Leave a Reply

Your email address will not be published. Required fields are marked *