Skip to content

Commit

Permalink
task: reintroduce support for core 2.1 as it is LTS
Browse files Browse the repository at this point in the history
* 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
alastairtree committed Dec 27, 2019
1 parent 7b19a1c commit 1244287
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 15 deletions.
9 changes: 5 additions & 4 deletions LazyCache.AspNetCore/LazyCache.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
<Description>ServiceCollection registrations for LazyCache to initialise the dependency injection collection and add enable IAppCache to be injected into your app</Description>
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
<PackageIcon>logo-128.png</PackageIcon>
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
<PackageTags>LazyCache DependecyInjection ServiceCollection Singleton Transient</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="microsoft.extensions.dependencyinjection.abstractions" Version="2.2.0" />
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>
<PackageReference Include="microsoft.extensions.dependencyinjection.abstractions" Version="2.1.0" />
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
</ItemGroup>

Expand Down
10 changes: 6 additions & 4 deletions LazyCache.Ninject/LazyCache.Ninject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
<Description>Ninject module regististrations for LazyCache to initialise dependency injection</Description>
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
<PackageIcon>logo-128.png</PackageIcon>
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
<PackageTags>LazyCache DependecyInjection ServiceCollection SingleTon Transient Ninject</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
<PackageReference Include="Ninject" Version="3.3.4" />
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>

<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
<PackageReference Include="Ninject" Version="3.3.0" />
<ProjectReference Include="..\LazyCache\LazyCache.csproj" />
</ItemGroup>

Expand Down
36 changes: 36 additions & 0 deletions LazyCache.UnitTestsCore21/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.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 LazyCache.UnitTestsCore21/LazyCache.UnitTestsCore21.csproj
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>
36 changes: 36 additions & 0 deletions LazyCache.UnitTestsCore22/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.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 LazyCache.UnitTestsCore22/LazyCache.UnitTestsCore22.csproj
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>
36 changes: 36 additions & 0 deletions LazyCache.UnitTestsCore30/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.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 LazyCache.UnitTestsCore30/LazyCache.UnitTestsCore30.csproj
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>
36 changes: 36 additions & 0 deletions LazyCache.UnitTestsCore31/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.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 LazyCache.UnitTestsCore31/LazyCache.UnitTestsCore31.csproj
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>
30 changes: 27 additions & 3 deletions LazyCache.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache", "LazyCache\LazyCache.csproj", "{E6A1EF20-94AD-4A1C-9A89-3B2FA8AD8EC7}"
EndProject
Expand All @@ -25,7 +25,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console.Net461", "Console.N
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.Ninject", "LazyCache.Ninject\LazyCache.Ninject.csproj", "{6FF349C3-D20C-493C-87A3-5A193538FE13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LazyCache.Ninject.UnitTests", "LazyCache.Ninject.UnitTests\LazyCache.Ninject.UnitTests.csproj", "{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.Ninject.UnitTests", "LazyCache.Ninject.UnitTests\LazyCache.Ninject.UnitTests.csproj", "{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore21", "LazyCache.UnitTestsCore21\LazyCache.UnitTestsCore21.csproj", "{A9092A92-0EA4-42DE-9522-8F86BA1E603E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore22", "LazyCache.UnitTestsCore22\LazyCache.UnitTestsCore22.csproj", "{69E47208-10AA-471D-AC26-AA95FF9EEA2D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore30", "LazyCache.UnitTestsCore30\LazyCache.UnitTestsCore30.csproj", "{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LazyCache.UnitTestsCore31", "LazyCache.UnitTestsCore31\LazyCache.UnitTestsCore31.csproj", "{2E025606-884D-4C48-8490-99EB1EA7B268}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -61,6 +69,22 @@ Global
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05FDA7C8-42B4-4B07-B148-EC5EFB98055B}.Release|Any CPU.Build.0 = Release|Any CPU
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9092A92-0EA4-42DE-9522-8F86BA1E603E}.Release|Any CPU.Build.0 = Release|Any CPU
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69E47208-10AA-471D-AC26-AA95FF9EEA2D}.Release|Any CPU.Build.0 = Release|Any CPU
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E1FEC4E-BE54-48AE-8C87-8A718BE1E3E2}.Release|Any CPU.Build.0 = Release|Any CPU
{2E025606-884D-4C48-8490-99EB1EA7B268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E025606-884D-4C48-8490-99EB1EA7B268}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E025606-884D-4C48-8490-99EB1EA7B268}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E025606-884D-4C48-8490-99EB1EA7B268}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
7 changes: 4 additions & 3 deletions LazyCache/LazyCache.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
<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>
<PackageProjectUrl>https://github.com/alastairtree/LazyCache</PackageProjectUrl>
<Copyright>Copyright 2014 - 2018 Alastair Crabtree</Copyright>
<PackageIconUrl>https://raw.githubusercontent.com/alastairtree/LazyCache/master/artwork/logo-128.png</PackageIconUrl>
<PackageIcon>logo-128.png</PackageIcon>
<RepositoryUrl>https://github.com/alastairtree/LazyCache</RepositoryUrl>
<PackageTags>Caching Performance Speed In-memory IMemoryCache Generics ServiceCacheing Lazy Cache Lazy-Load MemoryCache CachingService AppCache ApplicationCache Memcached</PackageTags>
<PackageReleaseNotes>See https://raw.githubusercontent.com/alastairtree/LazyCache/master/ReleaseNotes.md</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.2.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.2.0" />
<None Include="..\artwork\logo-128.png" Pack="true" PackagePath=""/>
<PackageReference Include="microsoft.extensions.caching.abstractions" Version="2.1.0" />
<PackageReference Include="microsoft.extensions.caching.memory" Version="2.1.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Try {

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

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

0 comments on commit 1244287

Please sign in to comment.