2013-05-01 04:11:00 +03:00
|
|
|
using System;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Common.Cache;
|
2013-05-23 08:12:01 +03:00
|
|
|
using NzbDrone.Test.Common;
|
2013-05-01 04:11:00 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Common.Test.CacheTests
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2013-05-23 08:12:01 +03:00
|
|
|
public class CachedManagerFixture:TestBase<ICacheManger>
|
2013-05-01 04:11:00 +03:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void should_return_proper_type_of_cache()
|
|
|
|
{
|
2013-05-23 08:12:01 +03:00
|
|
|
var result = Subject.GetCache<DateTime>(typeof(string));
|
2013-05-01 04:11:00 +03:00
|
|
|
|
|
|
|
result.Should().BeOfType<Cached<DateTime>>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void multiple_calls_should_get_the_same_cache()
|
|
|
|
{
|
2013-05-23 08:12:01 +03:00
|
|
|
var result1 = Subject.GetCache<DateTime>(typeof(string));
|
|
|
|
var result2 = Subject.GetCache<DateTime>(typeof(string));
|
2013-05-01 04:11:00 +03:00
|
|
|
|
|
|
|
result1.Should().BeSameAs(result2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|