Skip to content

Supporting inheritance of Assert and related classes #2842

Closed
@jnm2

Description

@jnm2

In #2836, the subject came up of allowing Assert and other *Assert classes to be extended through inheritance the way we do for Is, Iz, Does, Has, Throws, and Contains.

A past team, before NUnit 3, had decided that Assert should be inheritable:

public partial class Assert
{
#region Constructor
/// <summary>
/// We don't actually want any instances of this object, but some people
/// like to inherit from it to add other static methods. Hence, the
/// protected constructor disallows any instances of this object.
/// </summary>
protected Assert() { }

@CharliePoole asked for us to reconsider these classes, keeping in mind that, “The current team has never actually decided that we want people to be able to do this.”

➡ What do I mean by “supporting inheritance of Assert,” since it is currently inheritable? From my best understanding of #2836, I mean keeping it in the list of classes we test to ensure inheritance which we started in #2839.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions