Skip to content

Commit 57618d7

Browse files
authored
New Async API, net45, Sample WebApi App
* Upgrade net45, fluent assertions, VS, version rev * Add badges * Expose inner object cache * Add GetOrAddAsync api * Upgrade nunit to 3.4.1 * Lots of async tests * Add GetAsync method * upgrade nuget restore and use appveyor to pack not msbuild * Remove packages and restore on build * Add a sample web app to demonstrate async caching * Update docs
1 parent 36240d9 commit 57618d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1185
-54033
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,6 @@ Desktop.ini
187187

188188
# Recycle Bin used on file shares
189189
$RECYCLE.BIN/
190+
191+
packages/
192+
.vs/

.nuget/NuGet.Config

Lines changed: 0 additions & 6 deletions
This file was deleted.

.nuget/NuGet.exe

-1.58 MB
Binary file not shown.

.nuget/NuGet.targets

Lines changed: 0 additions & 144 deletions
This file was deleted.

LazyCache.UnitTests/AsyncHelper.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace LazyCache.UnitTests
8+
{
9+
public static class AsyncHelper
10+
{
11+
public static Task<T> CreateCancelledTask<T>()
12+
{
13+
var tcs = new TaskCompletionSource<T>();
14+
tcs.SetCanceled();
15+
return tcs.Task;
16+
}
17+
18+
public static Task<T> CreateTaskWithException<T, TException>() where TException : Exception
19+
{
20+
var tcs = new TaskCompletionSource<T>();
21+
tcs.SetException(Activator.CreateInstance<TException>());
22+
return tcs.Task;
23+
}
24+
}
25+
}

LazyCache.UnitTests/LazyCache.UnitTests.csproj

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>LazyCache.UnitTests</RootNamespace>
1111
<AssemblyName>LazyCache.UnitTests</AssemblyName>
12-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
15-
<RestorePackages>true</RestorePackages>
15+
<TargetFrameworkProfile />
1616
</PropertyGroup>
1717
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1818
<DebugSymbols>true</DebugSymbols>
@@ -22,6 +22,7 @@
2222
<DefineConstants>DEBUG;TRACE</DefineConstants>
2323
<ErrorReport>prompt</ErrorReport>
2424
<WarningLevel>4</WarningLevel>
25+
<Prefer32Bit>false</Prefer32Bit>
2526
</PropertyGroup>
2627
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2728
<DebugType>pdbonly</DebugType>
@@ -30,14 +31,20 @@
3031
<DefineConstants>TRACE</DefineConstants>
3132
<ErrorReport>prompt</ErrorReport>
3233
<WarningLevel>4</WarningLevel>
34+
<Prefer32Bit>false</Prefer32Bit>
3335
</PropertyGroup>
3436
<ItemGroup>
35-
<Reference Include="FluentAssertions">
36-
<HintPath>..\packages\FluentAssertions.2.2.0.0\lib\net40\FluentAssertions.dll</HintPath>
37+
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
38+
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
39+
<Private>True</Private>
3740
</Reference>
38-
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
39-
<SpecificVersion>False</SpecificVersion>
40-
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
41+
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
42+
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
46+
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
47+
<Private>True</Private>
4148
</Reference>
4249
<Reference Include="System" />
4350
<Reference Include="System.Core" />
@@ -49,12 +56,10 @@
4956
<Reference Include="System.Xml" />
5057
</ItemGroup>
5158
<ItemGroup>
59+
<Compile Include="AsyncHelper.cs" />
5260
<Compile Include="Properties\AssemblyInfo.cs" />
5361
<Compile Include="ServiceCacheTests.cs" />
5462
</ItemGroup>
55-
<ItemGroup>
56-
<None Include="packages.config" />
57-
</ItemGroup>
5863
<ItemGroup>
5964
<ProjectReference Include="..\LazyCache\LazyCache.csproj">
6065
<Project>{E6A1EF20-94AD-4A1C-9A89-3B2FA8AD8EC7}</Project>
@@ -64,14 +69,10 @@
6469
<ItemGroup>
6570
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
6671
</ItemGroup>
72+
<ItemGroup>
73+
<None Include="packages.config" />
74+
</ItemGroup>
6775
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
68-
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
69-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
70-
<PropertyGroup>
71-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
72-
</PropertyGroup>
73-
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
74-
</Target>
7576
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
7677
Other similar extension points exist, see Microsoft.Common.targets.
7778
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)