Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion TextFilter.Test/ReadmeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace TextFilter.Test;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -89,7 +90,10 @@ public void EveryMethodInTheReadmeApiReferenceExistsWithItsDocumentedDefaults()
foreach (Match row in rows)
{
string methodName = row.Groups["method"].Value;
MethodInfo[] overloads = [.. methods.Where(m => m.Name == methodName)];
// The binary-compatibility overloads are hidden from IntelliSense and deliberately carry no
// defaults, since defaults on both sets would make calls ambiguous. The README documents the
// visible overloads, so only those are held to its defaults.
MethodInfo[] overloads = [.. methods.Where(m => m.Name == methodName && !IsHiddenFromCallers(m))];
if (overloads.Length == 0)
{
problems.Add($"{methodName} does not exist");
Expand All @@ -115,6 +119,9 @@ public void EveryMethodInTheReadmeApiReferenceExistsWithItsDocumentedDefaults()
Assert.IsEmpty(problems, string.Join("; ", problems));
}

private static bool IsHiddenFromCallers(MethodInfo method) =>
method.GetCustomAttribute<EditorBrowsableAttribute>()?.State == EditorBrowsableState.Never;

[TestMethod]
public void ReadmeMatchOptionsSampleGivesTheDocumentedResults()
{
Expand Down
Loading