Skip to content

Commit

Permalink
Add test CanUseNamedCachesWithoutDefaultCache
Browse files Browse the repository at this point in the history
  • Loading branch information
jodydonetti committed May 19, 2024
1 parent 632606d commit 5936a61
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ZiggyCreatures.FusionCache.Tests/DependencyInjectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,4 +1190,23 @@ public void CanConsumeKeyedServices()
Assert.Contains(plugin, plugins!);
}
}

[Fact]
public void CanUseNamedCachesWithoutDefaultCache()
{
var services = new ServiceCollection();

services.AddFusionCache("Foo");
services.AddFusionCache("Bar");

using var serviceProvider = services.BuildServiceProvider();

var cacheProvider = serviceProvider.GetRequiredService<IFusionCacheProvider>();

var fooCache = cacheProvider.GetCache("Foo");
var barCache = cacheProvider.GetCache("Bar");

Assert.NotNull(fooCache);
Assert.NotNull(barCache);
}
}

0 comments on commit 5936a61

Please sign in to comment.