forked from alastairtree/LazyCache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: reintroduce support for core 2.1 as it is LTS
* downgrade references to core framework 2.1 (not 2.2) since that is the current LTS release * still allows nuget and child projects to reference newer versions of the dependencies as shown in the tests * Add tests for 2.1, 2.2, 3.0 and 3.1 frameworks and test on every build * fix compiler warning about nuget package logo fixes alastairtree#71
- Loading branch information
1 parent
7b19a1c
commit 1244287
Showing
13 changed files
with
275 additions
and
15 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
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
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.UnitTestsCore21 | ||
{ | ||
[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 GetOrAddOnCore21ReturnsTheCachedItem() | ||
{ | ||
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"}); | ||
|
||
Assert.IsNotNull(cachedResult); | ||
Assert.AreEqual("SomeValue", cachedResult.SomeProperty); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
LazyCache.UnitTestsCore21/LazyCache.UnitTestsCore21.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.11.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.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="2.1.2" /> | ||
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,36 @@ | ||
using LazyCache.Providers; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using NUnit.Framework; | ||
|
||
namespace LazyCache.UnitTestsCore22 | ||
{ | ||
[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 GetOrAddOnCore22ReturnsTheCachedItem() | ||
{ | ||
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"}); | ||
|
||
Assert.IsNotNull(cachedResult); | ||
Assert.AreEqual("SomeValue", cachedResult.SomeProperty); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
LazyCache.UnitTestsCore22/LazyCache.UnitTestsCore22.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.11.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.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="2.2.0" /> | ||
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,36 @@ | ||
using LazyCache.Providers; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using NUnit.Framework; | ||
|
||
namespace LazyCache.UnitTestsCore30 | ||
{ | ||
[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 GetOrAddOnCore30ReturnsTheCachedItem() | ||
{ | ||
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"}); | ||
|
||
Assert.IsNotNull(cachedResult); | ||
Assert.AreEqual("SomeValue", cachedResult.SomeProperty); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
LazyCache.UnitTestsCore30/LazyCache.UnitTestsCore30.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.0</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.11.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.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.0.1" /> | ||
<PackageReference Include="microsoft.extensions.caching.memory" Version="3.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,36 @@ | ||
using LazyCache.Providers; | ||
using Microsoft.Extensions.Caching.Memory; | ||
using NUnit.Framework; | ||
|
||
namespace LazyCache.UnitTestsCore31 | ||
{ | ||
[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 GetOrAddOnCore31ReturnsTheCachedItem() | ||
{ | ||
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"}); | ||
|
||
Assert.IsNotNull(cachedResult); | ||
Assert.AreEqual("SomeValue", cachedResult.SomeProperty); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
LazyCache.UnitTestsCore31/LazyCache.UnitTestsCore31.csproj
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,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.11.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.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> |
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
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