Improvement / Standardization of PackageSetting and TestPackage APIs

Aberta
#17 4 comentários 0 reações 1 responsável Ver no GitHub

@CharliePoole já está trabalhando nisso.

Desde 9/10/2026.

  • #18 de @CharliePoole — integrado

Avaliação

Esta issue ainda não foi avaliada.

Descrição

Enhancement

A TestPackage contains an enumeration of settings of type PackageSettings. Both classes have methods that operate upon and modify the contained settings.

PackageSettings has three basic methods that operate on it's contained settings: Add, Set and Remove. Each of these has several overloads, which are not relevant to this discussion.

  • Add adds a new setting. It fails if the setting is already present.
  • Set either adds a new setting or updates an existing one.
  • Remove removes a setting.

None of these operate on any sub-packages.

**TestPackage has the single method AddSetting, which calls PackageSettings.Add recursively, so that the same setting is added to the package itself and all its sub-packages. There is no equivalent for either Set or Remove.

I'm proposing to generalize this approach and optionally to remove the AddSetting method. Specifically...

  1. Give PackageSetting.Add, Set and Remove an additional boolean argument in all overloads, i.e. bool recursive.
  • When true, the call would apply to the package itself and all contained subpackages.
  • The argument could be optional (in which case it should default to false) or required. What do folks think?
  • If we prefer having additional overloads rather than adding the new argument to each existing overload, I'm OK with that, but the optional arg seems simpler to me.
  1. We need some consistent approach for TestPackage. We could do any of the following, which are listed in my own order of preference...
  • Eliminate TestPackage.PackageSetting. Clients calling it would have to use TestPackage.Settings.Addwith the value ofrecursive` specified as true.
  • Create TestPackage.Add, Set and Remove. This would add no functionality but save a bit of typing. Clients would use TestPackage.Add etc. rather than TestPackage.Settings.Add. Remove TestPackage.AddSettings.
  • Like the previous but retain TestPackage.AddSettings.

From the point of view of the Console Runner, this is merely a refactoring. No real functionality is affected. However, other clients, like the VS adapter and the TestCentric GUI will benefit by not having to perform recursion themselves.

So all points of view are covered, I'm asking for comments from the @nunit/engine-team, @OsirisTerje and @rowo360.

Linguagem predominante
C#
Estrelas
0
Forks
0
Merge médio
3d 13h
PRs com merge (30d)
2

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.