Just a basic question I hope is within the rules to ask. I have been looking for some information from some experience "Automated Testers" who have practiced this before. What is the business functionality of mocking static IEnumerable methods? Is there anything that is attained from mocking them? Does it just create clutter code/tests? How would someone know that it is worth writing a test for one of the IEnumerable methods? I have read up on the ways to accomplish the task of mocking and testing just curious what purpose it serves. Wouldn't system methods work just fine and not need to be tested?

Please excuse my questions if they are "green" I am just trying to get a deeper understanding/knowledge base of testing.

有帮助吗?

解决方案

There is no business functionality to mocking the system IEnumerable methods. To Mock static methods however, you should create a virtual class that calls the static methods. You then mock the virtual class allowing yourself to "access" the static methods in test.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top