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.
36 lines
1.4 KiB
C#
36 lines
1.4 KiB
C#
using ZB.MOM.WW.ScadaBridge.CLI.Commands;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.CLI.Tests;
|
|
|
|
/// <summary>
|
|
/// Regression tests for URL validation: a malformed <c>--url</c> previously reached
|
|
/// <c>new Uri(...)</c> in the <see cref="ZB.MOM.WW.ScadaBridge.CLI.ManagementHttpClient"/> constructor
|
|
/// and threw an unhandled <see cref="UriFormatException"/>.
|
|
/// </summary>
|
|
public class UrlValidationTests
|
|
{
|
|
/// <summary>Verifies that absolute HTTP and HTTPS URLs are accepted as management URLs.</summary>
|
|
/// <param name="url">The candidate management URL.</param>
|
|
[Theory]
|
|
[InlineData("http://localhost:9001")]
|
|
[InlineData("https://central-host:5000/")]
|
|
[InlineData("http://central")]
|
|
public void IsValidManagementUrl_AcceptsAbsoluteHttpUrls(string url)
|
|
{
|
|
Assert.True(CommandHelpers.IsValidManagementUrl(url));
|
|
}
|
|
|
|
/// <summary>Verifies that malformed or non-HTTP URLs are rejected as management URLs.</summary>
|
|
/// <param name="url">The candidate management URL.</param>
|
|
[Theory]
|
|
[InlineData("localhost:9001")] // no scheme
|
|
[InlineData("")] // empty
|
|
[InlineData(" ")] // whitespace
|
|
[InlineData("not a url")]
|
|
[InlineData("ftp://central:21")] // non-http scheme
|
|
public void IsValidManagementUrl_RejectsMalformedOrNonHttpUrls(string url)
|
|
{
|
|
Assert.False(CommandHelpers.IsValidManagementUrl(url));
|
|
}
|
|
}
|