简体   繁体   English

业务功能-RhinoMocks IEnumerable静态方法模拟

[英]Business functionality - RhinoMocks IEnumerable static method mocking

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? 模拟静态IEnumerable方法的业务功能是什么? 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? 谁会知道值得为IEnumerable方法之一编写测试? 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. 没有可以模拟系统IEnumerable方法的业务功能。 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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM