docs(tests): fix CommentChecker findings across tests/ — 13,392 → 0 (repo-wide scan clean)

Comment/XML-doc changes only:
- add summaries to ~10k test methods, fixtures, fakes and helpers
  (+ <param> on theories, <returns> on async Task methods,
  <inheritdoc/> on interface implementations the checker can resolve)
- strip ~2.6k project-tracking references (WP*, P*-*, row-NN, Task N,
  #NN, Component-0NN) from comments, keeping the explanatory text;
  reword false positives in comments only
- real docs on fakes implementing BCL/library interfaces
  (IDisposable, ILogger, IOptionsMonitor, IAsyncLifetime)
- reword the last 5 src/ false positives (CWE-1236, failures-1,
  year-0001, M365)

Only non-comment edits: four one-line nested classes split across lines
so members can carry docs. Build 0 errors / 0 warnings.
This commit is contained in:
Joseph Doherty
2026-10-07 15:05:49 -04:00
parent 0ffd4bdbea
commit 513fa1aa16
998 changed files with 17896 additions and 2395 deletions
@@ -73,6 +73,7 @@ public class EwsResponseParserTests
</s:Envelope>
""";
/// <summary>Verifies that a success response parses to a success result with no error.</summary>
[Fact]
public void Parse_SuccessResponse_ReturnsSuccessWithNoError()
{
@@ -82,6 +83,7 @@ public class EwsResponseParserTests
Assert.Equal("NoError", result.ResponseCode);
}
/// <summary>Verifies that an error response parses to an error result with its code and message.</summary>
[Fact]
public void Parse_ErrorResponse_ReturnsErrorWithCodeAndMessage()
{
@@ -92,6 +94,7 @@ public class EwsResponseParserTests
Assert.Equal("server busy", result.MessageText);
}
/// <summary>Verifies that a SOAP fault with a detail response code parses to a fault carrying that code.</summary>
[Fact]
public void Parse_SoapFaultWithDetailResponseCode_ReturnsFaultWithCode()
{
@@ -102,6 +105,7 @@ public class EwsResponseParserTests
Assert.Equal("The request failed schema validation.", result.MessageText);
}
/// <summary>Verifies that a SOAP fault without a response code parses to a fault with a null code.</summary>
[Fact]
public void Parse_SoapFaultWithoutResponseCode_ReturnsFaultWithNullCode()
{
@@ -112,6 +116,7 @@ public class EwsResponseParserTests
Assert.Equal("An internal server error occurred.", result.MessageText);
}
/// <summary>Verifies that a payload containing a DTD entity declaration is rejected as unparseable.</summary>
[Fact]
public void Parse_PayloadWithDtdEntityDeclaration_IsRejectedAsUnparseable()
{
@@ -152,6 +157,8 @@ public class EwsResponseParserTests
Assert.Null(result.MessageText);
}
/// <summary>Verifies that a garbage or unrelated payload is reported as unparseable.</summary>
/// <param name="body">The response body under test.</param>
[Theory]
[InlineData("not xml")]
[InlineData("")]
@@ -21,6 +21,7 @@ public class EwsSoapEnvelopeTests
string body = "Body")
=> XDocument.Parse(EwsSoapEnvelope.BuildCreateItem(from, bcc ?? ["one@example.com"], subject, body));
/// <summary>Verifies that the envelope sets the send-only disposition and the Exchange 2013 request version.</summary>
[Fact]
public void BuildCreateItem_SetsSendOnlyDispositionAndExchange2013RequestVersion()
{
@@ -34,6 +35,7 @@ public class EwsSoapEnvelopeTests
Assert.Single(doc.Descendants(Soap + "Header").Single().Elements());
}
/// <summary>Verifies that markup in the subject and body is escaped.</summary>
[Fact]
public void BuildCreateItem_EscapesMarkupInSubjectAndBody()
{
@@ -48,6 +50,7 @@ public class EwsSoapEnvelopeTests
Assert.Equal("Text", (string?)doc.Descendants(Types + "Body").Single().Attribute("BodyType"));
}
/// <summary>Verifies that every recipient is placed in the BCC list and no To recipients are emitted.</summary>
[Fact]
public void BuildCreateItem_PutsEveryRecipientInBccAndNeverEmitsToRecipients()
{
@@ -65,6 +68,7 @@ public class EwsSoapEnvelopeTests
Assert.DoesNotContain(doc.Descendants(), e => e.Name.LocalName is "ToRecipients" or "CcRecipients");
}
/// <summary>Verifies that the envelope emits the From mailbox.</summary>
[Fact]
public void BuildCreateItem_EmitsFromMailbox()
{
@@ -75,6 +79,7 @@ public class EwsSoapEnvelopeTests
Assert.Equal("scada-alerts@example.com", mailbox.Element(Types + "EmailAddress")!.Value);
}
/// <summary>Verifies that the message child elements follow the EWS schema sequence.</summary>
[Fact]
public void BuildCreateItem_OrdersMessageChildrenPerEwsSchemaSequence()
{
@@ -87,6 +92,7 @@ public class EwsSoapEnvelopeTests
message.Elements().Select(e => e.Name.LocalName).ToArray());
}
/// <summary>Verifies that the envelope starts with a UTF-8 XML declaration.</summary>
[Fact]
public void BuildCreateItem_StartsWithUtf8XmlDeclaration()
{
@@ -72,6 +72,8 @@ public class EwsSoapMailSenderTests
</s:Envelope>
""";
/// <summary>Verifies that a success response completes the send and the expected request was sent.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_SuccessResponse_CompletesAndSendsExpectedRequest()
{
@@ -88,6 +90,8 @@ public class EwsSoapMailSenderTests
Assert.Contains(Recipient, handler.CapturedContent);
}
/// <summary>Verifies that a non-HTTPS endpoint throws a permanent error without sending credentials.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_NonHttpsEndpoint_ThrowsPermanentWithoutSendingCredentials()
{
@@ -104,6 +108,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that a server-busy response body throws a transient error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_ServerBusyResponseBody_ThrowsTransient()
{
@@ -116,6 +122,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that an unauthorized response throws a permanent error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_Unauthorized_ThrowsPermanent()
{
@@ -128,6 +136,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that a schema fault on an HTTP 500 response throws a permanent error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_SchemaFaultOnHttp500_ThrowsPermanent()
{
@@ -142,6 +152,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that a bare service-unavailable response throws a transient error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_BareServiceUnavailable_ThrowsTransient()
{
@@ -154,6 +166,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that a transport failure throws a transient error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_TransportFailure_ThrowsTransient()
{
@@ -166,6 +180,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that a request exceeding the timeout throws a transient error rather than a cancellation.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_RequestExceedsTimeout_ThrowsTransientNotCancellation()
{
@@ -178,6 +194,8 @@ public class EwsSoapMailSenderTests
AssertNoCredentialLeak(ex);
}
/// <summary>Verifies that caller cancellation propagates unwrapped.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_CallerCancelled_PropagatesCancellationUnwrapped()
{
@@ -193,6 +211,8 @@ public class EwsSoapMailSenderTests
Assert.IsNotType<EwsPermanentException>(ex);
}
/// <summary>Verifies that a success status with an unparseable body throws a permanent error.</summary>
/// <returns>A task that represents the asynchronous operation.</returns>
[Fact]
public async Task SendAsync_SuccessStatusWithUnparseableBody_ThrowsPermanent()
{
@@ -242,6 +262,9 @@ public class EwsSoapMailSenderTests
/// <summary>The client name the sender asked for, so tests can pin the named registration.</summary>
public string? RequestedClientName { get; private set; }
/// <summary>Creates an HTTP client over the fake message handler.</summary>
/// <param name="name">The logical client name.</param>
/// <returns>An HTTP client backed by the fake handler.</returns>
public HttpClient CreateClient(string name)
{
RequestedClientName = name;
@@ -260,26 +283,40 @@ public class EwsSoapMailSenderTests
private StubHandler(Func<CancellationToken, Task<HttpResponseMessage>> responder)
=> _responder = responder;
/// <summary>Gets the authorization scheme of the captured request.</summary>
public string? CapturedScheme { get; private set; }
/// <summary>Gets the authorization parameter of the captured request.</summary>
public string? CapturedParameter { get; private set; }
/// <summary>Gets the content media type of the captured request.</summary>
public string? CapturedMediaType { get; private set; }
/// <summary>Gets the serialized body of the captured request.</summary>
public string CapturedContent { get; private set; } = string.Empty;
/// <summary>How many times the handler was reached — 0 proves a guard fired first.</summary>
public int InvocationCount { get; private set; }
/// <summary>Creates a handler that answers every request with the given status and XML body.</summary>
/// <param name="status">The HTTP status code to return.</param>
/// <param name="body">The XML response body.</param>
/// <returns>A handler that returns the canned response.</returns>
public static StubHandler Responding(HttpStatusCode status, string body)
=> new(_ => Task.FromResult(new HttpResponseMessage(status)
{
Content = new StringContent(body, Encoding.UTF8, "text/xml"),
}));
/// <summary>Creates a handler that fails every request with the given exception.</summary>
/// <param name="exception">The exception to throw.</param>
/// <returns>A handler that throws.</returns>
public static StubHandler Throwing(Exception exception)
=> new(_ => Task.FromException<HttpResponseMessage>(exception));
/// <summary>Creates a handler that waits for the given delay before answering, so a timeout can trip.</summary>
/// <param name="delay">How long to wait before responding.</param>
/// <returns>A handler that responds after the delay.</returns>
public static StubHandler Delaying(TimeSpan delay)
=> new(async token =>
{
@@ -287,6 +324,7 @@ public class EwsSoapMailSenderTests
return new HttpResponseMessage(HttpStatusCode.OK);
});
/// <inheritdoc />
protected override async Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{