using Titano.Testing; using Titano.Uploader.Server; namespace Titano.App.Tests.Uploader; public sealed class ServerAddressTests { [Theory] [Case("nas.local:8443", "https://nas.local:8443/")] [Case("https://nas.local:8443", "https://nas.local:8443/")] [Case(" http://192.168.1.20:8080/titano ", "http://192.168.1.20:8080/titano/")] [Case("https://nas.local/?x=1#y", "https://nas.local/")] public void ServerAddressesBecomeApiBases(string typed, string expected) { Assert.True(ServerAddress.TryParse(typed, out var uri)); Assert.Equal(expected, uri.ToString()); } [Theory] [Case("")] [Case(" ")] [Case("ftp://nas.local")] [Case("https://")] public void InvalidServerAddressesAreRejected(string typed) => Assert.False(ServerAddress.TryParse(typed, out _)); }