public void Can_scan_100_collection_over_cursor() { var allKeys = new HashSet <string>(); var keys = Enumerable.Range(0, 100).Select(x => "KEY" + x).ToList(); this.Redis.SetAll(keys.ToDictionary(x => x, x1 => x1)); var i = 0; var ret = new ScanResult(); while (true) { ret = this.Redis.Scan(ret.Cursor, 10); i++; ret.AsStrings().ForEach(x => allKeys.Add(x)); if (ret.Cursor == 0) { break; } } Assert.That(i, Is.GreaterThanOrEqualTo(2)); Assert.That(allKeys.Count, Is.EqualTo(keys.Count)); Assert.That(allKeys, Is.EquivalentTo(keys)); }
public void Can_scan_100_collection_over_cursor() { var allKeys = new HashSet <string>(); Redis.FlushAll(); var keys = 100.Times(x => "KEY" + x); Redis.SetAll(keys.ToSafeDictionary(x => x)); var i = 0; var ret = new ScanResult(); while (true) { ret = Redis.Scan(ret.Cursor, 10); i++; ret.AsStrings().ForEach(x => allKeys.Add(x)); if (ret.Cursor == 0) { break; } } Assert.That(i, Is.GreaterThanOrEqualTo(2)); Assert.That(allKeys.Count, Is.EqualTo(keys.Count)); Assert.That(allKeys, Is.EquivalentTo(keys)); }
public void Can_scan_100_collection_over_cursor() { var allKeys = new HashSet<string>(); Redis.FlushAll(); var keys = 100.Times(x => "KEY" + x); Redis.SetAll(keys.ToSafeDictionary(x => x)); var i = 0; var ret = new ScanResult(); while (true) { ret = Redis.Scan(ret.Cursor, 10); i++; ret.AsStrings().ForEach(x => allKeys.Add(x)); if (ret.Cursor == 0) break; } Assert.That(i, Is.GreaterThanOrEqualTo(2)); Assert.That(allKeys.Count, Is.EqualTo(keys.Count)); Assert.That(allKeys, Is.EquivalentTo(keys)); }