public async Task HashDecrMin() { var v = new RedisHash(settings, "test-hash"); await v.Set("a", 100); (await v.IncrementLimitByMin("a", -10, 0)).Is(90); (await v.IncrementLimitByMin("a", -20, 0)).Is(70); (await v.IncrementLimitByMin("a", -30, 0)).Is(40); (await v.IncrementLimitByMin("a", -42, 0)).Is(0); (await v.IncrementLimitByMin("a", -50, 0)).Is(0); (await v.Get <long>("a")).Is(0); var v2 = new RedisHash(settings, "test-hash"); await v2.Set("a", 100); (await v2.IncrementLimitByMin("a", -10.5, 0.5)).Is(89.5); (await v2.IncrementLimitByMin("a", -20.5, 0.5)).Is(69); (await v2.IncrementLimitByMin("a", -40.5, 0.5)).Is(28.5); (await v2.IncrementLimitByMin("a", -40.5, 0.5)).Is(0.5); (await v2.Get <double>("a")).Is(0.5); }
public async Task HashDecrMin() { var v = new RedisHash(settings, "test-hash"); await v.Set("a", 100); (await v.IncrementLimitByMin("a", -10, 0)).Is(90); (await v.IncrementLimitByMin("a", -20, 0)).Is(70); (await v.IncrementLimitByMin("a", -30, 0)).Is(40); (await v.IncrementLimitByMin("a", -42, 0)).Is(0); (await v.IncrementLimitByMin("a", -50, 0)).Is(0); (await v.Get<long>("a")).Is(0); var v2 = new RedisHash(settings, "test-hash"); await v2.Set("a", 100); (await v2.IncrementLimitByMin("a", -10.5, 0.5)).Is(89.5); (await v2.IncrementLimitByMin("a", -20.5, 0.5)).Is(69); (await v2.IncrementLimitByMin("a", -40.5, 0.5)).Is(28.5); (await v2.IncrementLimitByMin("a", -40.5, 0.5)).Is(0.5); (await v2.Get<double>("a")).Is(0.5); }