问题描述
在C#/WPF
上下文中,模拟是什么意思?
在单元测试的上下文中,模拟提供了一种虚假的实现,该类型的实现与您的被测代码可以交互.
请参见 http://en.wikipedia.org/wiki/Mock_object
Roy Osherove的单元测试的艺术" 有很好的解释,我建议您阅读从C#中的单元测试开始
模拟与存根的不同之处在于,它可以与被测代码进行交互验证.存根仅返回预定义的值以帮助对代码进行单元测试.
What does the term mocking mean in the context of C#/WPF
?
In the context of unit testing, mocking is providing a fake implementation of a type that your code under test interacts with.
See http://en.wikipedia.org/wiki/Mock_object
The book "The Art of Unit Testing" by Roy Osherove has good explanations and I recommend it if you are getting started with unit testing in C#
A mock differs from a stub in that it verifies the interaction with your code under test. A stub simply returns pre-defined values to help unit test your code.
这篇关于术语“模拟"的含义是什么?在C#中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!