测试抽象类的具体方法 [英] Testing Abstract Class Concrete Methods

查看:150
本文介绍了测试抽象类的具体方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何设计和组织测试一个抽象类的具体方法呢?特别是在.NET。

How would I design and organize tests for the concrete methods of an abstract class? Specifically in .NET.

推荐答案

您必须创建一个实现了抽象方法(与空的方法)的子类,但没有具体的人。这个子类应该是唯一的测试(它应该永远不会进入生产code)。不理会在你的单元测试覆盖的抽象方法,并专注于具体的方法。

You have to create a subclass that implements the abstract methods (with empty methods), but none of the concrete ones. This subclass should be for testing only (it should never go into your production code). Just ignore the overridden abstract methods in your unit tests and concentrate on the concrete methods.

这篇关于测试抽象类的具体方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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