Browse Source

Fix AbpCachingTestModule

pull/848/head
Halil ibrahim Kalkan 8 years ago
parent
commit
78aee0adaa
  1. 3
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs
  2. 13
      framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs

3
framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/AbpCachingTestModule.cs

@ -13,13 +13,14 @@ namespace Volo.Abp.Caching
{ {
option.CacheConfigurators.Add(cacheName => option.CacheConfigurators.Add(cacheName =>
{ {
if (cacheName == typeof(Sail.Testing.Caching.PersonCacheItem).FullName) if (cacheName == CacheNameAttribute.GetCacheName(typeof(Sail.Testing.Caching.PersonCacheItem)))
{ {
return new DistributedCacheEntryOptions() return new DistributedCacheEntryOptions()
{ {
AbsoluteExpiration = DateTime.Parse("2099-01-01 12:00:00") AbsoluteExpiration = DateTime.Parse("2099-01-01 12:00:00")
}; };
} }
return null; return null;
}); });

13
framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs

@ -1,9 +1,7 @@
using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Distributed;
using Shouldly; using Shouldly;
using System; using System;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
@ -12,20 +10,11 @@ namespace Volo.Abp.Caching
public class DistributedCache_ConfigureOptions_Test : AbpIntegratedTest<AbpCachingTestModule> public class DistributedCache_ConfigureOptions_Test : AbpIntegratedTest<AbpCachingTestModule>
{ {
[Fact] [Fact]
public async Task Configure_CacheOptions() public void Configure_CacheOptions()
{ {
var personCache = GetRequiredService<IDistributedCache<Sail.Testing.Caching.PersonCacheItem>>(); var personCache = GetRequiredService<IDistributedCache<Sail.Testing.Caching.PersonCacheItem>>();
var cacheKey = Guid.NewGuid().ToString();
//Get (not exists yet)
var cacheItem = await personCache.GetAsync(cacheKey);
cacheItem.ShouldBeNull();
GetDefaultCachingOptions(personCache).SlidingExpiration.ShouldBeNull(); GetDefaultCachingOptions(personCache).SlidingExpiration.ShouldBeNull();
GetDefaultCachingOptions(personCache).AbsoluteExpiration.ShouldBe(new DateTime(2099, 1, 1, 12, 0, 0)); GetDefaultCachingOptions(personCache).AbsoluteExpiration.ShouldBe(new DateTime(2099, 1, 1, 12, 0, 0));
} }
[Fact] [Fact]

Loading…
Cancel
Save