-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions package for a named client
- Loading branch information
1 parent
c88baee
commit f82a31f
Showing
26 changed files
with
841 additions
and
469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Kentico.Kontent.Delivery.Caching.Tests/CacheManagerFactoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using FakeItEasy; | ||
using FluentAssertions; | ||
using Kentico.Kontent.Delivery.Caching.Factories; | ||
using Microsoft.Extensions.Caching.Distributed; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using Microsoft.Extensions.Options; | ||
using Xunit; | ||
|
||
namespace Kentico.Kontent.Delivery.Caching.Tests | ||
{ | ||
public class CacheManagerFactoryTests | ||
{ | ||
private IOptions<DeliveryCacheOptions> _options; | ||
private IDistributedCache _distributedCache; | ||
private IMemoryCache _memoryCache; | ||
|
||
public CacheManagerFactoryTests() | ||
{ | ||
_options = A.Fake<IOptions<DeliveryCacheOptions>>(); | ||
_distributedCache = A.Fake<IDistributedCache>(); | ||
_memoryCache = A.Fake<IMemoryCache>(); | ||
} | ||
|
||
[Fact] | ||
public void Create_DistributedCache() | ||
{ | ||
var deliveryCacheManager = CacheManagerFactory.Create(_distributedCache, _options); | ||
|
||
deliveryCacheManager.Should().NotBeNull(); | ||
} | ||
|
||
[Fact] | ||
public void Create_MemoryCache() | ||
{ | ||
var deliveryCacheManager = CacheManagerFactory.Create(_memoryCache, _options); | ||
|
||
deliveryCacheManager.Should().NotBeNull(); | ||
} | ||
} | ||
} |
60 changes: 0 additions & 60 deletions
60
Kentico.Kontent.Delivery.Caching.Tests/Factories/DeliveryCacheManagerFactoryTests.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 0 additions & 81 deletions
81
Kentico.Kontent.Delivery.Caching/DeliveryClientCacheFactory.cs
This file was deleted.
Oops, something went wrong.
11 changes: 9 additions & 2 deletions
11
Kentico.Kontent.Delivery.Caching/Extensions/DeliveryCacheOptionsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
namespace Kentico.Kontent.Delivery.Caching.Extensions | ||
{ | ||
internal static class DeliveryCacheOptionsExtensions | ||
/// <summary> | ||
/// Extensions for a <see cref="DeliveryCacheOptions"/>. | ||
/// </summary> | ||
public static class DeliveryCacheOptionsExtensions | ||
{ | ||
/// <summary> | ||
/// Maps a <see cref="DeliveryCacheOptions"/> to each other. | ||
/// </summary> | ||
/// <param name="o">A destination.</param> | ||
/// <param name="options">A source.</param> | ||
public static void Configure(this DeliveryCacheOptions o, DeliveryCacheOptions options) | ||
{ | ||
o.CacheType = options.CacheType; | ||
o.DefaultExpiration = options.DefaultExpiration; | ||
o.DefaultExpirationType = options.DefaultExpirationType; | ||
o.StaleContentExpiration = options.StaleContentExpiration; | ||
o.Name = o.Name; | ||
} | ||
} | ||
} |
Oops, something went wrong.