forked from jellyfin/jellyfin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test for ListsingsManager.DeleteListingsProvider(). (jellyfin#1…
…2793) * Added test for DeleteListingsProvider(). * Added myself to CONTRIBUTORS.md * Removed unintentionally committed test SaveListingProvider_SavesProviderAndReturnsInfo() * Cleaned up test in response to PR feedback.
- Loading branch information
1 parent
556f4c4
commit e922fe8
Showing
2 changed files
with
51 additions
and
0 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
50 changes: 50 additions & 0 deletions
50
tests/Jellyfin.LiveTv.Tests/Listings/ListingsManagerTests.cs
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 System; | ||
using Jellyfin.LiveTv.Configuration; | ||
using Jellyfin.LiveTv.Listings; | ||
using MediaBrowser.Common.Configuration; | ||
using MediaBrowser.Controller.LiveTv; | ||
using MediaBrowser.Model.LiveTv; | ||
using MediaBrowser.Model.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Jellyfin.LiveTv.Tests.Listings; | ||
|
||
public class ListingsManagerTests | ||
{ | ||
private readonly IConfigurationManager _config; | ||
private readonly IListingsProvider[] _listingsProviders; | ||
private readonly ILogger<ListingsManager> _logger; | ||
private readonly ITaskManager _taskManager; | ||
private readonly ITunerHostManager _tunerHostManager; | ||
|
||
public ListingsManagerTests() | ||
{ | ||
_logger = Mock.Of<ILogger<ListingsManager>>(); | ||
_config = Mock.Of<IConfigurationManager>(); | ||
_taskManager = Mock.Of<ITaskManager>(); | ||
_tunerHostManager = Mock.Of<ITunerHostManager>(); | ||
_listingsProviders = new[] { Mock.Of<IListingsProvider>() }; | ||
} | ||
|
||
[Fact] | ||
public void DeleteListingsProvider_DeletesProvider() | ||
{ | ||
// Arrange | ||
var id = "MockId"; | ||
var manager = new ListingsManager(_logger, _config, _taskManager, _tunerHostManager, _listingsProviders); | ||
|
||
Mock.Get(_config) | ||
.Setup(x => x.GetConfiguration(It.IsAny<string>())) | ||
.Returns(new LiveTvOptions { ListingProviders = [new ListingsProviderInfo { Id = id }] }); | ||
|
||
// Act | ||
manager.DeleteListingsProvider(id); | ||
|
||
// Assert | ||
Assert.DoesNotContain( | ||
_config.GetLiveTvConfiguration().ListingProviders, | ||
p => p.Id.Equals(id, StringComparison.Ordinal)); | ||
} | ||
} |