什么是模拟课?使用这个? [英] what is mock class?Use of this?

查看:89
本文介绍了什么是模拟课?使用这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们必须使用mock类。

where we have to use mock class.

推荐答案

Mocking简介 [ ^ ]



模拟类 [ ^ ]

如何在C#中模拟类成员? [ ^ ]

这里是模拟成员 [ ^ ]
Introduction to Mocking[^]

Mock Class[^]
How to mock class members in C#?[^]
here are the Mock Members[^]


Mock是Typemock Isolator模拟类型控制器,这个类用于管理虚拟模拟

命名空间:TypeMock

程序集:TypeMock(在TypeMock.dll中) )版本:7.1.6.0(7.1.6.0)



模拟对象有3个阶段。

设置 - 这是你的舞台''记录''模拟类型/对象期望做什么以及返回什么

运行 - 运行测试中的实际类

验证 - 确保模拟对象按预期行事

这些阶段由Mock对象管理。

注意:你不能直接使用MockManager.Mock创建模拟(类型)

注意:你不能模拟接口类,使用MockManager.MockObject(Type,Object [])

注意:当模拟一个声明的方法时模拟一个声明的方法在基类中,Typemock Isolator只会在模拟类型调用时模拟该方法。当模拟基本方法并且派生类调用该方法时,它不会被模拟
Mock is the Typemock Isolator mock type controller, this class is use for managing the virtual mocks
Namespace: TypeMock
Assembly: TypeMock (in TypeMock.dll) Version: 7.1.6.0 (7.1.6.0)

Mock object have 3 stages.
Set Up - This is the stage where you ''record'' what the mocked type/object expects to do and what to return
Run - Run the actual class under test
Verify - Make sure that the mocked object acted as expected
These phases are managed by the Mock object.
Note: You cannot create a Mock directly use MockManager.Mock(Type)
Note: You cannot mock Interfaces Classes, Use MockManager.MockObject(Type, Object[])
Note:When mocking a method that is declared in When mocking a method that is declared in a base class, Typemock Isolator will only mock that method when called from the mocked type. When a base method is mocked and a derived class calls that method, it WON''T be mocked


关于模拟类的文章 [ ^ ]


这篇关于什么是模拟课?使用这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆