File tree Expand file tree Collapse file tree 13 files changed +275
-15
lines changed
LazyCache.UnitTestsCore21
LazyCache.UnitTestsCore22
LazyCache.UnitTestsCore30
LazyCache.UnitTestsCore31 Expand file tree Collapse file tree 13 files changed +275
-15
lines changed Original file line number Diff line number Diff line change 16
16
<Description >ServiceCollection registrations for LazyCache to initialise the dependency injection collection and add enable IAppCache to be injected into your app</Description >
17
17
<Copyright >Copyright 2014 - 2018 Alastair Crabtree</Copyright >
18
18
<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 >
20
20
<RepositoryUrl >https://github.com/alastairtree/LazyCache</RepositoryUrl >
21
21
<PackageTags >LazyCache DependecyInjection ServiceCollection Singleton Transient</PackageTags >
22
22
<PackageLicenseExpression >MIT</PackageLicenseExpression >
23
23
</PropertyGroup >
24
24
25
25
26
26
<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" />
30
31
<ProjectReference Include =" ..\LazyCache\LazyCache.csproj" />
31
32
</ItemGroup >
32
33
Original file line number Diff line number Diff line change 16
16
<Description >Ninject module regististrations for LazyCache to initialise dependency injection</Description >
17
17
<Copyright >Copyright 2014 - 2018 Alastair Crabtree</Copyright >
18
18
<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 >
20
20
<RepositoryUrl >https://github.com/alastairtree/LazyCache</RepositoryUrl >
21
21
<PackageTags >LazyCache DependecyInjection ServiceCollection SingleTon Transient Ninject</PackageTags >
22
22
<PackageLicenseExpression >MIT</PackageLicenseExpression >
23
23
</PropertyGroup >
24
24
25
25
<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" />
29
31
<ProjectReference Include =" ..\LazyCache\LazyCache.csproj" />
30
32
</ItemGroup >
31
33
Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments