public void FetchRangeDoesNotExist() { var date = DateTime.Now; var store = new InMemoryWindowStore("store", defaultRetention, (long)defaultSize.TotalMilliseconds); var it = store.FetchAll(date.AddDays(-1), date.AddDays(1)); Assert.AreEqual(null, it.Current); Assert.IsFalse(it.MoveNext()); Assert.AreEqual(null, it.Current); }
public void EmptyKeyValueIteratorTest() { var dt = DateTime.Now; var store = new InMemoryWindowStore("store", TimeSpan.FromSeconds(1), (long)defaultSize.TotalMilliseconds); var enumerator = store.FetchAll(dt.AddDays(1), dt); Assert.IsAssignableFrom <EmptyKeyValueEnumerator <Windowed <Bytes>, byte[]> >(enumerator); Assert.IsFalse(enumerator.MoveNext()); enumerator.Reset(); Assert.AreEqual(0, enumerator.ToList().Count); }
public void PutElementsAndFetch() { var date = DateTime.Now; var key = new Bytes(Encoding.UTF8.GetBytes("test-key")); var key2 = new Bytes(Encoding.UTF8.GetBytes("coucou-key")); var store = new InMemoryWindowStore("store", defaultRetention, (long)defaultSize.TotalMilliseconds); store.Put(key, BitConverter.GetBytes(100), date.GetMilliseconds()); store.Put(key2, BitConverter.GetBytes(300), date.AddSeconds(1).GetMilliseconds()); var r = store.FetchAll(date.AddSeconds(-10), date.AddSeconds(20)).ToList(); Assert.AreEqual(2, r.Count); Assert.AreEqual(key, r[0].Key.Key); Assert.AreEqual(BitConverter.GetBytes(100), r[0].Value); Assert.AreEqual(defaultSize, r[0].Key.Window.TotalTime); Assert.AreEqual(key2, r[1].Key.Key); Assert.AreEqual(BitConverter.GetBytes(300), r[1].Value); Assert.AreEqual(defaultSize, r[1].Key.Window.TotalTime); }