Skip to content

Commit 1244287

Browse files
committed
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 #71
1 parent 7b19a1c commit 1244287

File tree

13 files changed

+275
-15
lines changed

13 files changed

+275
-15
lines changed

LazyCache.AspNetCore/LazyCache.AspNetCore.csproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
<Description>ServiceCollection registrations for LazyCache to initialise the dependency injection collection and add enable IAppCache to be injected into your app</Description>
1717
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
1818
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
19-
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
19+
<PackageIcon>logo-128.png</PackageIcon>
2020
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
2121
<PackageTags>LazyCache DependecyInjection ServiceCollection Singleton Transient</PackageTags>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
</PropertyGroup>
2424

2525

2626
<ItemGroup>
27-
<PackageReference Include="microsoft.extensions.dependencyinjection.abstractions" Version="2.2.0" />
28-
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
29-
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
27+
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>
28+
<PackageReference Include="microsoft.extensions.dependencyinjection.abstractions" Version="2.1.0" />
29+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
30+
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
3031
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
3132
</ItemGroup>
3233

LazyCache.Ninject/LazyCache.Ninject.csproj

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
<Description>Ninject module regististrations for LazyCache to initialise dependency injection</Description>
1717
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
1818
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
19-
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
19+
<PackageIcon>logo-128.png</PackageIcon>
2020
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
2121
<PackageTags>LazyCache DependecyInjection ServiceCollection SingleTon Transient Ninject</PackageTags>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
</PropertyGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
27-
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
28-
<PackageReference Include="Ninject" Version="3.3.4" />
26+
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>
27+
28+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
29+
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
30+
<PackageReference Include="Ninject" Version="3.3.0" />
2931
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
3032
</ItemGroup>
3133

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using LazyCache.Providers;
2+
using Microsoft.Extensions.Caching.Memory;
3+
using NUnit.Framework;
4+
5+
namespace LazyCache.UnitTestsCore21
6+
{
7+
[TestFixture]
8+
public class CachingServiceTests
9+
{
10+
private static CachingService BuildCache()
11+
{
12+
return new CachingService(new MemoryCacheProvider(new MemoryCache(new MemoryCacheOptions())));
13+
}
14+
15+
private IAppCache sut;
16+
17+
18+
private const string TestKey = "testKey";
19+
20+
[SetUp]
21+
public void BeforeEachTest()
22+
{
23+
sut = BuildCache();
24+
}
25+
26+
27+
[Test]
28+
public void GetOrAddOnCore21ReturnsTheCachedItem()
29+
{
30+
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"});
31+
32+
Assert.IsNotNull(cachedResult);
33+
Assert.AreEqual("SomeValue", cachedResult.SomeProperty);
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="nunit" Version="3.11.0" />
10+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
16+
<ProjectReference Include="..\LazyCache.AspNetCore\LazyCache.AspNetCore.csproj" />
17+
<ProjectReference Include="..\LazyCache.Ninject\LazyCache.Ninject.csproj" />
18+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.2" />
19+
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.2" />
20+
</ItemGroup>
21+
22+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using LazyCache.Providers;
2+
using Microsoft.Extensions.Caching.Memory;
3+
using NUnit.Framework;
4+
5+
namespace LazyCache.UnitTestsCore22
6+
{
7+
[TestFixture]
8+
public class CachingServiceTests
9+
{
10+
private static CachingService BuildCache()
11+
{
12+
return new CachingService(new MemoryCacheProvider(new MemoryCache(new MemoryCacheOptions())));
13+
}
14+
15+
private IAppCache sut;
16+
17+
18+
private const string TestKey = "testKey";
19+
20+
[SetUp]
21+
public void BeforeEachTest()
22+
{
23+
sut = BuildCache();
24+
}
25+
26+
27+
[Test]
28+
public void GetOrAddOnCore22ReturnsTheCachedItem()
29+
{
30+
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"});
31+
32+
Assert.IsNotNull(cachedResult);
33+
Assert.AreEqual("SomeValue", cachedResult.SomeProperty);
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="nunit" Version="3.11.0" />
10+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
16+
<ProjectReference Include="..\LazyCache.AspNetCore\LazyCache.AspNetCore.csproj" />
17+
<ProjectReference Include="..\LazyCache.Ninject\LazyCache.Ninject.csproj" />
18+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
19+
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
20+
</ItemGroup>
21+
22+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using LazyCache.Providers;
2+
using Microsoft.Extensions.Caching.Memory;
3+
using NUnit.Framework;
4+
5+
namespace LazyCache.UnitTestsCore30
6+
{
7+
[TestFixture]
8+
public class CachingServiceTests
9+
{
10+
private static CachingService BuildCache()
11+
{
12+
return new CachingService(new MemoryCacheProvider(new MemoryCache(new MemoryCacheOptions())));
13+
}
14+
15+
private IAppCache sut;
16+
17+
18+
private const string TestKey = "testKey";
19+
20+
[SetUp]
21+
public void BeforeEachTest()
22+
{
23+
sut = BuildCache();
24+
}
25+
26+
27+
[Test]
28+
public void GetOrAddOnCore30ReturnsTheCachedItem()
29+
{
30+
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"});
31+
32+
Assert.IsNotNull(cachedResult);
33+
Assert.AreEqual("SomeValue", cachedResult.SomeProperty);
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="nunit" Version="3.11.0" />
10+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
16+
<ProjectReference Include="..\LazyCache.AspNetCore\LazyCache.AspNetCore.csproj" />
17+
<ProjectReference Include="..\LazyCache.Ninject\LazyCache.Ninject.csproj" />
18+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="3.0.1" />
19+
<PackageReference Include="microsoft.extensions.caching.memory" Version="3.0.1" />
20+
</ItemGroup>
21+
22+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using LazyCache.Providers;
2+
using Microsoft.Extensions.Caching.Memory;
3+
using NUnit.Framework;
4+
5+
namespace LazyCache.UnitTestsCore31
6+
{
7+
[TestFixture]
8+
public class CachingServiceTests
9+
{
10+
private static CachingService BuildCache()
11+
{
12+
return new CachingService(new MemoryCacheProvider(new MemoryCache(new MemoryCacheOptions())));
13+
}
14+
15+
private IAppCache sut;
16+
17+
18+
private const string TestKey = "testKey";
19+
20+
[SetUp]
21+
public void BeforeEachTest()
22+
{
23+
sut = BuildCache();
24+
}
25+
26+
27+
[Test]
28+
public void GetOrAddOnCore31ReturnsTheCachedItem()
29+
{
30+
var cachedResult = sut.GetOrAdd(TestKey, () => new {SomeProperty = "SomeValue"});
31+
32+
Assert.IsNotNull(cachedResult);
33+
Assert.AreEqual("SomeValue", cachedResult.SomeProperty);
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="nunit" Version="3.11.0" />
10+
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
16+
<ProjectReference Include="..\LazyCache.AspNetCore\LazyCache.AspNetCore.csproj" />
17+
<ProjectReference Include="..\LazyCache.Ninject\LazyCache.Ninject.csproj" />
18+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="3.1.0" />
19+
<PackageReference Include="microsoft.extensions.caching.memory" Version="3.1.0" />
20+
</ItemGroup>
21+
22+
</Project>

LazyCache.sln

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27130.2036
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29613.14
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache", "LazyCache\LazyCache.csproj", "{E6A1EF20-94AD-4A1C-9A89-3B2FA8AD8EC7}"
77
EndProject
@@ -25,7 +25,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console.Net461", "Console.N
2525
EndProject
2626
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.Ninject", "LazyCache.Ninject\LazyCache.Ninject.csproj", "{6FF349C3-D20C-493C-87A3-5A193538FE13}"
2727
EndProject
28-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LazyCache.Ninject.UnitTests", "LazyCache.Ninject.UnitTests\LazyCache.Ninject.UnitTests.csproj", "{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}"
28+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.Ninject.UnitTests", "LazyCache.Ninject.UnitTests\LazyCache.Ninject.UnitTests.csproj", "{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}"
29+
EndProject
30+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore21", "LazyCache.UnitTestsCore21\LazyCache.UnitTestsCore21.csproj", "{A9092A92-0EA4-42DE-9522-8F86BA1E603E}"
31+
EndProject
32+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore22", "LazyCache.UnitTestsCore22\LazyCache.UnitTestsCore22.csproj", "{69E47208-10AA-471D-AC26-AA95FF9EEA2D}"
33+
EndProject
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore30", "LazyCache.UnitTestsCore30\LazyCache.UnitTestsCore30.csproj", "{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}"
35+
EndProject
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore31", "LazyCache.UnitTestsCore31\LazyCache.UnitTestsCore31.csproj", "{2E025606-884D-4C48-8490-99EB1EA7B268}"
2937
EndProject
3038
Global
3139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -61,6 +69,22 @@ Global
6169
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Debug|Any CPU.Build.0 = Debug|Any CPU
6270
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Release|Any CPU.ActiveCfg = Release|Any CPU
6371
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Release|Any CPU.Build.0 = Release|Any CPU
72+
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
73+
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Debug|Any CPU.Build.0 = Debug|Any CPU
74+
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Release|Any CPU.ActiveCfg = Release|Any CPU
75+
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Release|Any CPU.Build.0 = Release|Any CPU
76+
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77+
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
78+
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
79+
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Release|Any CPU.Build.0 = Release|Any CPU
80+
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81+
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
82+
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
83+
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Release|Any CPU.Build.0 = Release|Any CPU
84+
{2E025606-884D-4C48-8490-99EB1EA7B268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85+
{2E025606-884D-4C48-8490-99EB1EA7B268}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{2E025606-884D-4C48-8490-99EB1EA7B268}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{2E025606-884D-4C48-8490-99EB1EA7B268}.Release|Any CPU.Build.0 = Release|Any CPU
6488
EndGlobalSection
6589
GlobalSection(SolutionProperties) = preSolution
6690
HideSolutionNode = FALSE

LazyCache/LazyCache.csproj

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@
1515
<Description>Lazy cache is a simple, thread safe, in-memory caching library that makes it easy to add high performance caching to your dotnet app.</Description>
1616
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
1717
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
18-
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
18+
<PackageIcon>logo-128.png</PackageIcon>
1919
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
2020
<PackageTags>Caching Performance Speed In-memory IMemoryCache Generics ServiceCacheing Lazy Cache Lazy-Load MemoryCache CachingService AppCache ApplicationCache Memcached</PackageTags>
2121
<PackageReleaseNotes>See https://raw.githubusercontent.com/alastairtree/LazyCache/master/ReleaseNotes.md</PackageReleaseNotes>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
</PropertyGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
27-
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
26+
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>
27+
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
28+
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
2829
</ItemGroup>
2930

3031
</Project>

build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Try {
3737

3838
# Find each test project and run tests. upload results to AppVeyor
3939
Get-ChildItem .\**\*.csproj -Recurse |
40-
Where-Object { $_.Name -match ".*Test(s)?.csproj$"} |
40+
Where-Object { $_.Name -match ".*Test.*\.csproj$"} |
4141
ForEach-Object {
4242

4343
Exec { dotnet test $_.FullName --configuration $config --no-build --no-restore --logger:"trx;LogFileName=..\..\test-result.trx" }

0 commit comments

Comments
 (0)