我们需要创建三个模拟对象类。
创建一个模拟对象类作为具体类中的一个子类。
Create a mock object class as a subclass of the concrete class.
已有的模拟对象类可以再度使用,稍做修改就可以用于未来的测试。
The mock object classes we have can be reused and enhanced for future tests with minimal effort.
有时您可能需要开发更复杂的模拟对象类,因为他们会带给您额外的收益。
Sometimes you may want to develop much more complex mock object classes because they will give you additional benefits.
我们大约需要编写50行代码来真正执行我们在模拟对象类中所需的行为。
We had to write approximately 50 lines of code that actually implemented the behavior we needed in our mock object classes.
只要有针对类使用的对象的方法执行,简单的模拟期望就足以测试那些执行。
As long as there are method executions against objects the class USES, simple mock expectations are sufficient to test those executions.
模拟对象将模仿出于指导代码执行的惟一目的而编写的类的行为,以便它在测试时符合代码执行要求。
Mock objects mimic the behavior of classes written with the sole purpose of guiding code execution so that it falls within those areas under test.
上述代码定义了Customer类的操作,但我们需要在运行模拟之前,创建一些实际的顾客对象。
The above code defines what a Customer class does, but we need to create some actual customer objects before we run a simulation.
经验证明,如果测试类扩展的整个TestCase对象属于RMock,则通过两个框架构造和使用模拟对象将更容易。
Experience shows that it's easier to construct and use mock objects from both frameworks if the overall TestCase object from which the test class extends belongs to RMock.
客户端服务层定义了具体的实现类,负责从指示板传递数据、生成请求对象和调用特定的模拟器服务。
The client service layer defines the implementation classes responsible for taking the data passed from the dashboard, creating the request objects, and invoking a specified simulator service.
不过该静态类有助于开发者更加方便地在ASP.NETMVC应用程序中创建模拟对象。
This static class helps to make mocking a lot easier in ASP.NET MVC applications.
构建基于classb类的模拟对象并向其提供期望。
A mock object based on a ClassB class is constructed and provided an expectation.
此类只是我使用的一个虚构类,用于强化一个要点:要模拟构造函数接收对象参数的类,有必要使用RMock。
This class is just a dummy class I use to reinforce the point that RMock is necessary for mocking classes in which constructors receive object parameters.
相反,在类中编写通用方法以模拟以上的操作就比较合适了,它继承了appobjects文件夹中的GUI对象类。
Instead, it's good to write a generic method in a class to simulate the above action, which inherits the GUI object class in the appobjects folder.
模拟对象到Collaborator类型的类强制转换十分有必要,因为intercept方法将返回类型Object。
The class cast of the mock object into type Collaborator is necessary because the intercept method returns type object.
模拟对象现已准备好在serviceclass类中作为实际对象使用。
The mock object is now ready for use in the ServiceClass class as a real object.
将面向对象思想应用于化工过程模拟领域,提出了为重用而系统地建立化工过程模拟类库的思想。
Object oriented technology is used to chemical process simulation, and the idea of developing a class library for chemical process simulation is provided.
该装置可模拟塔类装置的各种过程,以此为对象进行各种控制策略的实践和理论的研究。
This equipment can simulate the processes of tower equipment of many kinds, and can carry on control strategies practice and theory researches based on this equipment.
该装置可模拟塔类装置的各种过程,以此为对象进行各种控制策略的实践和理论的研究。
This equipment can simulate the processes of tower equipment of many kinds, and can carry on control strategies practice and theory researches based on this equipment.
应用推荐