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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user