mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
New: All setting values are cached for better responsiveness.
This commit is contained in:
parent
2051c9d911
commit
6df184b7cb
6 changed files with 101 additions and 24 deletions
|
@ -0,0 +1,35 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.ConfigProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ConfigCachingFixture : CoreTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<IDatabase>().Setup(c => c.Fetch<Config>())
|
||||
.Returns(new List<Config> { new Config { Key = "Key1", Value = "Value1" } });
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void getting_value_more_than_once_should_hit_db_once()
|
||||
{
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
Mocker.Resolve<ConfigProvider>().GetValue("Key1", null).Should().Be("Value1");
|
||||
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.Fetch<Config>(), Times.Once());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue