Skip to content

Commit

Permalink
Check tests work with .net 5.0 (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
gamblen authored Sep 6, 2021
1 parent 677ffbb commit cbb7c1b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
36 changes: 36 additions & 0 deletions LazyCache.UnitTestsNet50/CachingServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using LazyCache.Providers;
using Microsoft.Extensions.Caching.Memory;
using NUnit.Framework;

namespace LazyCache.UnitTestsNet50
{
[TestFixture]
public class CachingServiceTests
{
private static CachingService BuildCache()
{
return new CachingService(new MemoryCacheProvider(new MemoryCache(new MemoryCacheOptions())));
}

private IAppCache sut;


private const string TestKey = "testKey";

[SetUp]
public void BeforeEachTest()
{
sut = BuildCache();
}


[Test]
public void GetOrAddOnNet50ReturnsTheCachedItem()
{
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"});

Assert.IsNotNull(cachedResult);
Assert.AreEqual("SomeValue", cachedResult.SomeProperty);
}
}
}
20 changes: 20 additions & 0 deletions LazyCache.UnitTestsNet50/LazyCache.UnitTestsNet50.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
<ProjectReference Include="..\LazyCache.AspNetCore\LazyCache.AspNetCore.csproj" />
<ProjectReference Include="..\LazyCache.Ninject\LazyCache.Ninject.csproj" />
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="3.1.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="3.1.0" />
</ItemGroup>
</Project>
8 changes: 7 additions & 1 deletion LazyCache.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore30",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore31", "LazyCache.UnitTestsCore31\LazyCache.UnitTestsCore31.csproj", "{2E025606-884D-4C48-8490-99EB1EA7B268}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LazyCache.Benchmarks", "LazyCache.Benchmarks\LazyCache.Benchmarks.csproj", "{CE7DF61F-03B2-493E-8BFF-6E744015DE14}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.Benchmarks", "LazyCache.Benchmarks\LazyCache.Benchmarks.csproj", "{CE7DF61F-03B2-493E-8BFF-6E744015DE14}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsNet50", "LazyCache.UnitTestsNet50\LazyCache.UnitTestsNet50.csproj", "{735910E0-E533-4D8B-91AC-6CA7415DEE0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -91,6 +93,10 @@ Global
{CE7DF61F-03B2-493E-8BFF-6E744015DE14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE7DF61F-03B2-493E-8BFF-6E744015DE14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE7DF61F-03B2-493E-8BFF-6E744015DE14}.Release|Any CPU.Build.0 = Release|Any CPU
{735910E0-E533-4D8B-91AC-6CA7415DEE0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{735910E0-E533-4D8B-91AC-6CA7415DEE0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{735910E0-E533-4D8B-91AC-6CA7415DEE0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{735910E0-E533-4D8B-91AC-6CA7415DEE0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit cbb7c1b

Please sign in to comment.