mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-11-26 19:50:36 +00:00
commit
8b8f0fd149
31
Tests/MemoryCacheExtensionTests.cs
Normal file
31
Tests/MemoryCacheExtensionTests.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CompatBot.Utils;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Tests;
|
||||
|
||||
[TestFixture]
|
||||
public class MemoryCacheExtensionTests
|
||||
{
|
||||
[Test]
|
||||
public void GetCacheKeysTest()
|
||||
{
|
||||
var cache = new MemoryCache(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromHours(1) });
|
||||
Assert.That(cache.GetCacheKeys<int>().Count, Is.EqualTo(0));
|
||||
|
||||
cache.Set(13, "val13");
|
||||
Assert.That(cache.GetCacheKeys<int>().Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCacheEntriesTest()
|
||||
{
|
||||
var cache = new MemoryCache(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromHours(1) });
|
||||
Assert.That(cache.GetCacheKeys<int>().Count, Is.EqualTo(0));
|
||||
|
||||
cache.Set(13, "val13");
|
||||
Assert.That(cache.GetCacheKeys<int>().Count, Is.EqualTo(1));
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DuoVia.FuzzyStrings" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0">
|
||||
|
Loading…
Reference in New Issue
Block a user