513fa1aa16
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.
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.NotificationService.Tests;
|
|
|
|
/// <summary>
|
|
/// Tests for parsing the configured SMTP TLS mode into the three-state enum.
|
|
/// </summary>
|
|
public class SmtpTlsModeParserTests
|
|
{
|
|
/// <summary>Verifies that a known mode string parses to the expected TLS mode.</summary>
|
|
/// <param name="input">The configured mode string.</param>
|
|
/// <param name="expected">The expected parsed TLS mode.</param>
|
|
[Theory]
|
|
[InlineData("none", SmtpTlsMode.None)]
|
|
[InlineData("None", SmtpTlsMode.None)]
|
|
[InlineData("NONE", SmtpTlsMode.None)]
|
|
[InlineData("starttls", SmtpTlsMode.StartTls)]
|
|
[InlineData("StartTLS", SmtpTlsMode.StartTls)]
|
|
[InlineData("ssl", SmtpTlsMode.Ssl)]
|
|
[InlineData("SSL", SmtpTlsMode.Ssl)]
|
|
[InlineData(" starttls ", SmtpTlsMode.StartTls)]
|
|
public void Parse_KnownModes_ReturnsExpected(string input, SmtpTlsMode expected)
|
|
{
|
|
Assert.Equal(expected, SmtpTlsModeParser.Parse(input));
|
|
}
|
|
|
|
/// <summary>Verifies that a null or empty mode defaults to StartTLS.</summary>
|
|
/// <param name="input">The null or empty mode string.</param>
|
|
[Theory]
|
|
[InlineData(null)]
|
|
[InlineData("")]
|
|
[InlineData(" ")]
|
|
public void Parse_NullOrEmpty_DefaultsToStartTls(string? input)
|
|
{
|
|
Assert.Equal(SmtpTlsMode.StartTls, SmtpTlsModeParser.Parse(input));
|
|
}
|
|
|
|
/// <summary>Verifies that an unknown mode string throws.</summary>
|
|
/// <param name="input">The unrecognized mode string.</param>
|
|
[Theory]
|
|
[InlineData("auto")]
|
|
[InlineData("tls")]
|
|
[InlineData("implicit")]
|
|
public void Parse_UnknownMode_Throws(string input)
|
|
{
|
|
// An unknown mode must be rejected, not silently treated as Auto.
|
|
Assert.Throws<ArgumentException>(() => SmtpTlsModeParser.Parse(input));
|
|
}
|
|
}
|