diff options
| author | Cody Robibero <cody@robibe.ro> | 2023-06-05 16:47:50 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2023-06-05 16:47:50 -0600 |
| commit | cb788dbd73c8b003b22a2f376289b98cf212f0a4 (patch) | |
| tree | 2ee0626b8a1d15d1310bcd858ae3a5ef91999d0c | |
| parent | 29368a1566afcbfa861e3cf431156ee0f73f1f2b (diff) | |
Mock configuration to get SqliteCacheSizeKey during test
| -rw-r--r-- | tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs index 7d92e7b26..0d2b488bc 100644 --- a/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs +++ b/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs @@ -6,6 +6,7 @@ using Emby.Server.Implementations.Data; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; +using Microsoft.Extensions.Configuration; using Moq; using Xunit; @@ -27,8 +28,18 @@ namespace Jellyfin.Server.Implementations.Tests.Data appHost.Setup(x => x.ReverseVirtualPath(It.IsAny<string>())) .Returns((string x) => x.Replace(MetaDataPath, VirtualMetaDataPath, StringComparison.Ordinal)); + var configSection = new Mock<IConfigurationSection>(); + configSection + .SetupGet(x => x[It.Is<string>(s => s == MediaBrowser.Controller.Extensions.ConfigurationExtensions.SqliteCacheSizeKey)]) + .Returns("0"); + var config = new Mock<IConfiguration>(); + config + .Setup(x => x.GetSection(It.Is<string>(s => s == MediaBrowser.Controller.Extensions.ConfigurationExtensions.SqliteCacheSizeKey))) + .Returns(configSection.Object); + _fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true }); _fixture.Inject(appHost); + _fixture.Inject(config); _sqliteItemRepository = _fixture.Create<SqliteItemRepository>(); } |
