-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Jellyfin.Plugin.MetaShark.Api; | ||
using Jellyfin.Plugin.MetaShark.Core; | ||
using Jellyfin.Plugin.MetaShark.Providers; | ||
using MediaBrowser.Controller.Library; | ||
using MediaBrowser.Controller.Providers; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.Extensions.Logging; | ||
using Moq; | ||
|
||
namespace Jellyfin.Plugin.MetaShark.Test | ||
{ | ||
[TestClass] | ||
public class BoxSetProviderTest | ||
{ | ||
|
||
ILoggerFactory loggerFactory = LoggerFactory.Create(builder => | ||
builder.AddSimpleConsole(options => | ||
{ | ||
options.IncludeScopes = true; | ||
options.SingleLine = true; | ||
options.TimestampFormat = "hh:mm:ss "; | ||
})); | ||
|
||
|
||
[TestMethod] | ||
public void TestGetMetadata() | ||
{ | ||
var info = new BoxSetInfo() { Name = "攻壳机动队(系列)", MetadataLanguage = "zh" }; | ||
var httpClientFactory = new DefaultHttpClientFactory(); | ||
var libraryManagerStub = new Mock<ILibraryManager>(); | ||
libraryManagerStub.Setup(x => x.ParseName(info.Name)).Returns(new ItemLookupInfo(){Name = info.Name}); | ||
var httpContextAccessorStub = new Mock<IHttpContextAccessor>(); | ||
var doubanApi = new DoubanApi(loggerFactory); | ||
var tmdbApi = new TmdbApi(loggerFactory); | ||
var omdbApi = new OmdbApi(loggerFactory); | ||
var imdbApi = new ImdbApi(loggerFactory); | ||
|
||
Task.Run(async () => | ||
{ | ||
var provider = new BoxSetProvider(httpClientFactory, loggerFactory, libraryManagerStub.Object, httpContextAccessorStub.Object, doubanApi, tmdbApi, omdbApi, imdbApi); | ||
var result = await provider.GetMetadata(info, CancellationToken.None); | ||
Assert.IsNotNull(result); | ||
|
||
var str = result.ToJson(); | ||
Console.WriteLine(result.ToJson()); | ||
}).GetAwaiter().GetResult(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters