Resolve all 46 low-severity architecture review findings
This commit is contained in:
@@ -4,6 +4,19 @@ namespace ZB.MOM.WW.ScadaBridge.DelmiaNotifier.Tests;
|
||||
|
||||
public class ConfigLoaderTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("relative")]
|
||||
[InlineData("ftp://example.com")]
|
||||
[InlineData("https://good.example,broken")]
|
||||
[InlineData("http://")]
|
||||
public void Load_RejectsInvalidEndpointsBeforeDispatch(string urls)
|
||||
{
|
||||
var error = Assert.Throws<InvalidOperationException>(() =>
|
||||
ConfigLoader.Load(System.Text.Json.JsonSerializer.Serialize(new { ScadaBridge = new { BaseUrls = urls } })));
|
||||
Assert.Contains("ScadaBridge:BaseUrls", error.Message);
|
||||
Assert.Contains("HTTP", error.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SplitBaseUrls_trims_and_drops_empties()
|
||||
{
|
||||
@@ -29,8 +42,8 @@ public class ConfigLoaderTests
|
||||
[Fact]
|
||||
public void Load_reads_all_fields()
|
||||
{
|
||||
var cfg = ConfigLoader.Load("{\"ScadaBridge\":{\"BaseUrls\":\"a,b\",\"TimeoutSeconds\":5,\"LogPath\":\"l.log\"}}");
|
||||
Assert.Equal("a,b", cfg.ScadaBridge.BaseUrls);
|
||||
var cfg = ConfigLoader.Load("{\"ScadaBridge\":{\"BaseUrls\":\"https://a,http://b\",\"TimeoutSeconds\":5,\"LogPath\":\"l.log\"}}");
|
||||
Assert.Equal("https://a,http://b", cfg.ScadaBridge.BaseUrls);
|
||||
Assert.Equal(5, cfg.ScadaBridge.TimeoutSeconds);
|
||||
Assert.Equal("l.log", cfg.ScadaBridge.LogPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user