31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Helpdesk.Web.Api;
|
|||
|
|
using Helpdesk.Web.Infrastructure;
|
||
|
|
|
||
|
|
namespace Helpdesk.Web.Tests;
|
||
|
|
|
||
|
|
public class ApiVersioningTests
|
||
|
|
{
|
||
|
|
[Theory]
|
||
|
|
[InlineData("http://api:8080/")]
|
||
|
|
[InlineData("http://api:8080")]
|
||
|
|
public void Zaklad_adresy_obsahuje_verzi_API(string baseUrl) =>
|
||
|
|
Assert.Equal("http://api:8080/api/v1/", new ApiOptions { BaseUrl = baseUrl }.VersionedBaseAddress().ToString());
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public void Relativni_cesta_se_slozi_pod_verzi()
|
||
|
|
{
|
||
|
|
var baseAddress = new ApiOptions { BaseUrl = "http://api:8080/" }.VersionedBaseAddress();
|
||
|
|
|
||
|
|
Assert.Equal("/api/v1/auth/login", new Uri(baseAddress, "auth/login").AbsolutePath);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public class AppVersionTests
|
||
|
|
{
|
||
|
|
[Theory]
|
||
|
|
[InlineData("0.2.0+6e742b4029cca8896173c0d64783b7fb7540f214", "0.2.0 (6e742b4)")]
|
||
|
|
[InlineData("0.2.0", "0.2.0")]
|
||
|
|
[InlineData(null, "neznámá")]
|
||
|
|
public void Verze_se_zobrazi_s_kratkym_hashem_commitu(string? informational, string expected) =>
|
||
|
|
Assert.Equal(expected, AppVersion.Format(informational));
|
||
|
|
}
|