nunit / nunit.analyzers

Roslyn analyzers for writing unit tests with NUnit
MIT License
85 stars 29 forks source link

Fix the typo in the title for NUnit2014 #751

Open Bartleby2718 opened 1 month ago

Bartleby2718 commented 1 month ago

See the conversation in #749 for context.

Looking at https://github.com/nunit/nunit.analyzers/blob/master/src/nunit.analyzers/Constants/AnalyzerIdentifiers.cs#L57

        internal const string CollectionContainsConstraintUsage = "NUnit2014";

it does seems like SomeItemsConstraint is a typo and therefore should be fixed to something like CollectionContainsConstraint in the following places: https://github.com/search?q=repo%3Anunit%2Fnunit.analyzers%20%22Use%20SomeItemsConstraint%20for%20better%20assertion%20messages%20in%20case%20of%20failure%22&type=code

Since this is a minor typo fix, you can likely bundle it with another such issue: #714.

manfred-brands commented 1 month ago

It is not a typo, Does.Contain returns an SomeItemsConstraint:

/// <summary>
/// Returns a new <see cref="SomeItemsConstraint"/> checking for the
/// presence of a particular object in the collection.
/// </summary>
public static SomeItemsConstraint Contain(object? expected) =>
    new(new EqualConstraint(expected));

Unfortunately NUnit has constrain classes and convenience methods to create them and the naming of both might not align.