diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-12-18 11:53:41 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-12-18 11:53:41 +0100 |
| commit | a1ca50fd5a74eafa6e609976d90cad42b54137e5 (patch) | |
| tree | 9c64d6914c27a8d7e2f8e6f71d7a5952197705cf /tests | |
| parent | 8723bdbb4fb73ed261ac1ba3b6932773e523d78b (diff) | |
| parent | 6b185119aa329764c1ccc57d9be3e81f05680b69 (diff) | |
Merge branch 'namingtests' of https://github.com/Bond-009/jellyfin into namingtests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.Api.Tests/GetPathValueTests.cs | 45 | ||||
| -rw-r--r-- | tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj | 20 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/Jellyfin.Api.Tests/GetPathValueTests.cs b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs new file mode 100644 index 000000000..b01d1af1f --- /dev/null +++ b/tests/Jellyfin.Api.Tests/GetPathValueTests.cs @@ -0,0 +1,45 @@ +using MediaBrowser.Api; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Net; +using MediaBrowser.Model.Configuration; +using MediaBrowser.Model.Services; +using Microsoft.Extensions.Logging.Abstractions; +using Moq; +using Xunit; + +namespace Jellyfin.Api.Tests +{ + public class GetPathValueTests + { + [Theory] + [InlineData("https://localhost:8096/ScheduledTasks/1234/Triggers", "", 1, "1234")] + [InlineData("https://localhost:8096/emby/ScheduledTasks/1234/Triggers", "", 1, "1234")] + [InlineData("https://localhost:8096/mediabrowser/ScheduledTasks/1234/Triggers", "", 1, "1234")] + [InlineData("https://localhost:8096/jellyfin/2/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + [InlineData("https://localhost:8096/jellyfin/2/emby/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + [InlineData("https://localhost:8096/jellyfin/2/mediabrowser/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + [InlineData("https://localhost:8096/JELLYFIN/2/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + [InlineData("https://localhost:8096/JELLYFIN/2/Emby/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + [InlineData("https://localhost:8096/JELLYFIN/2/MediaBrowser/ScheduledTasks/1234/Triggers", "jellyfin/2", 1, "1234")] + public void GetPathValueTest(string path, string baseUrl, int index, string value) + { + var reqMock = Mock.Of<IRequest>(x => x.PathInfo == path); + var conf = new ServerConfiguration() + { + BaseUrl = baseUrl + }; + + var confManagerMock = Mock.Of<IServerConfigurationManager>(x => x.Configuration == conf); + + var service = new BrandingService( + new NullLogger<BrandingService>(), + confManagerMock, + Mock.Of<IHttpResultFactory>()) + { + Request = reqMock + }; + + Assert.Equal(value, service.GetPathValue(index).ToString()); + } + } +} diff --git a/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj new file mode 100644 index 000000000..1671b8d79 --- /dev/null +++ b/tests/Jellyfin.Api.Tests/Jellyfin.Api.Tests.csproj @@ -0,0 +1,20 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netcoreapp3.0</TargetFramework> + <IsPackable>false</IsPackable> + </PropertyGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> + <PackageReference Include="xunit" Version="2.4.1" /> + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" /> + <PackageReference Include="coverlet.collector" Version="1.1.0" /> + <PackageReference Include="Moq" Version="4.13.1" /> + </ItemGroup> + + <ItemGroup> + <ProjectReference Include="../../MediaBrowser.Api/MediaBrowser.Api.csproj" /> + </ItemGroup> + +</Project> |
