2018-06-29 19:52:40 +02:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Umbraco.Core.Cache;
|
|
|
|
|
using Umbraco.Tests.TestHelpers;
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Tests.Cache
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-01-18 08:14:08 +01:00
|
|
|
public class HttpRequestAppCacheTests : AppCacheTests
|
2018-06-29 19:52:40 +02:00
|
|
|
{
|
2019-01-17 11:01:23 +01:00
|
|
|
private HttpRequestAppCache _provider;
|
2018-06-29 19:52:40 +02:00
|
|
|
private FakeHttpContextFactory _ctx;
|
|
|
|
|
|
|
|
|
|
public override void Setup()
|
|
|
|
|
{
|
|
|
|
|
base.Setup();
|
|
|
|
|
_ctx = new FakeHttpContextFactory("http://localhost/test");
|
2019-01-17 11:01:23 +01:00
|
|
|
_provider = new HttpRequestAppCache(_ctx.HttpContext);
|
2018-06-29 19:52:40 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-18 08:14:08 +01:00
|
|
|
internal override IAppCache AppCache
|
2018-06-29 19:52:40 +02:00
|
|
|
{
|
|
|
|
|
get { return _provider; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override int GetTotalItemCount
|
|
|
|
|
{
|
|
|
|
|
get { return _ctx.HttpContext.Items.Count; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
2019-01-18 08:14:08 +01:00
|
|
|
public class StaticAppCacheTests : AppCacheTests
|
2018-06-29 19:52:40 +02:00
|
|
|
{
|
2019-01-17 11:01:23 +01:00
|
|
|
private DictionaryCacheProvider _provider;
|
2018-06-29 19:52:40 +02:00
|
|
|
|
|
|
|
|
public override void Setup()
|
|
|
|
|
{
|
|
|
|
|
base.Setup();
|
2019-01-17 11:01:23 +01:00
|
|
|
_provider = new DictionaryCacheProvider();
|
2018-06-29 19:52:40 +02:00
|
|
|
}
|
|
|
|
|
|
2019-01-18 08:14:08 +01:00
|
|
|
internal override IAppCache AppCache
|
2018-06-29 19:52:40 +02:00
|
|
|
{
|
|
|
|
|
get { return _provider; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override int GetTotalItemCount
|
|
|
|
|
{
|
2019-01-17 11:01:23 +01:00
|
|
|
get { return _provider.Items.Count; }
|
2018-06-29 19:52:40 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|