public void store_an_entity_retrieve_it_from_store_perf_test() { var strategy = new Storage.LuceneStrategy(); var store = new Storage.LucenceStore<Key, Entity>(entityStorage, strategy, index); var key = new Key("test", DateTime.Parse("01/01/2012")); store.AddOrUpdate(key, () => new Entity(10, 10), (e) => e, Lokad.Cqrs.AtomicStorage.AddOrUpdateHint.ProbablyExists); Entity entity; Assert.IsTrue(store.TryGet(key, out entity)); Assert.IsTrue(entity.ItemCount == 10); Assert.IsTrue(entity.TotalAmount == 10); System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); for (int _index = 1; _index <= 1000; _index++) { entity = null; stopWatch.Start(); store.TryGet(key, out entity); stopWatch.Stop(); Debug.WriteLine(stopWatch.Elapsed.ToString()); Debug.WriteLine(entity.ToString()); stopWatch.Reset(); } store.Dispose(); }
public void store_an_entity_and_retrieve_it_from_store() { var strategy = new Storage.LuceneStrategy(); var store = new Storage.LucenceStore<Key, Entity>(entityStorage, strategy, index); var key = new Key("test",DateTime.Parse("01/01/2012")); store.AddOrUpdate(key, () => new Entity(10, 10), (e) => e, Lokad.Cqrs.AtomicStorage.AddOrUpdateHint.ProbablyExists); Entity entity; Assert.IsTrue(store.TryGet(key,out entity)); Assert.IsTrue(entity.ItemCount == 10); Assert.IsTrue(entity.TotalAmount == 10); store.Dispose(); }