xunit / xunit/xunit

Add extensibility point for custom argument formatting

Open
#1,914 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assertion library Feature
Dominant language
C#
Stars
4.6k
Forks
846
Avg merge
1d 8m
Merged PRs (30d)
3

Description

Today, our logic for formatting arguments is fairly involved: https://github.com/xunit/assert.xunit/blob/master/Sdk/ArgumentFormatter.cs

For complex objects, we allow the user to override the argument formatting with ToString(). While this is convenient, it isn't exactly the purpose of ToString(). We should offer a better extensibility point (that takes priority over most of our logic).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Sdk/ArgumentFormatter.cs and tracing its existing argument-formatting logic, especially how ToString() is used for complex objects. Define what the new extensibility point should accept and when it takes priority over the current formatting rules; the issue is done when that design is implemented and covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.