Skip to content

Commit

Permalink
extensions package for a named client
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasjurasek committed Jan 13, 2021
1 parent b144843 commit 83439a3
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
40 changes: 40 additions & 0 deletions Kentico.Kontent.Delivery.Caching.Tests/CacheManagerFactoryTests.cs
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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Kentico.Kontent.Delivery.Caching.Factories
/// </summary>
public static class CacheManagerFactory
{

/// <summary>
/// Creates an <see cref="IDeliveryCacheManager"/> instance with a distributed cache.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class DeliveryClientFactory : IDeliveryClientFactory
/// </summary>
/// <param name="deliveryOptions">Used for notifications when <see cref="DeliveryOptions"/> instances change.</param>
/// <param name="serviceProvider">An <see cref="IServiceProvider"/> instance.</param>
/// <param name="componentContext">Autofac container</param>
/// <param name="componentContext">An autofac component context.</param>
public DeliveryClientFactory(IOptionsMonitor<DeliveryOptions> deliveryOptions, IServiceProvider serviceProvider,
IComponentContext componentContext)
{
Expand Down

0 comments on commit 83439a3

Please sign in to comment.