Commit e4052948 authored by Marc Gravell's avatar Marc Gravell

add make it possible to switch test rig between frameworks

parent 7cafb442
......@@ -2,7 +2,7 @@
<PropertyGroup>
<Description>StackExchange.Redis.BasicTest .NET Core</Description>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.0;netcoreapp2.1;net47</TargetFrameworks>
<AssemblyName>BasicTest</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>BasicTest</PackageId>
......@@ -12,7 +12,8 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StackExchange.Redis\StackExchange.Redis.csproj" />
<!--<ProjectReference Include="..\StackExchange.Redis\StackExchange.Redis.csproj" />-->
<PackageReference Include="StackExchange.Redis" Version="1.2.7-alpha-00002" />
</ItemGroup>
</Project>
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using StackExchange.Redis;
......@@ -28,18 +29,20 @@ public static async Task Main()
await set;
Console.WriteLine(await s);
const int COUNT = 10000;
var rand = new Random(12345);
RedisKey counter = "counter";
var watch = Stopwatch.StartNew();
db.KeyDelete(counter, CommandFlags.FireAndForget);
for (int i = 0; i < 1000; i++)
for (int i = 0; i < COUNT; i++)
{
int x = rand.Next(50);
//Console.WriteLine($"{i}:{x}");
expected += x;
db.StringIncrement(counter, x); //, CommandFlags.FireAndForget);
db.StringIncrement(counter, x, CommandFlags.FireAndForget);
}
int actual = (int)await db.StringGetAsync(counter);
Console.WriteLine($"{expected} vs {actual}");
watch.Stop();
Console.WriteLine($"{expected} vs {actual}, {watch.ElapsedMilliseconds}ms for {COUNT} incrby");
}
catch (Exception ex)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment