public void TestEventStoreFunctions() { EventStore es = new EventStore(); Assert.AreEqual(0, es.GetEventCount()); TrackerPayload payload = new TrackerPayload(); payload.Add("hello", "world"); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.AreEqual(4, es.GetEventCount()); Assert.IsTrue(es.DeleteEvent(4)); Assert.AreEqual(3, es.GetEventCount()); Assert.IsTrue(es.DeleteEvents(new List <int> { 3, 2 })); Assert.AreEqual(1, es.GetEventCount()); Assert.IsTrue(es.DeleteAllEvents()); Assert.AreEqual(0, es.GetEventCount()); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.IsTrue(es.AddEvent(payload)); Assert.AreEqual(4, es.GetEventCount()); Assert.AreEqual(4, es.GetAllEvents().Count); Assert.AreEqual(2, es.GetDescEventRange(2).Count); Assert.AreEqual(payload.GetDictionary(), es.GetEvent(1).GetPayload().GetDictionary()); Assert.IsTrue(es.DeleteAllEvents()); }
private static void PrintEvents() { Console.WriteLine("\n==== EVENTS LIST ===="); var events = _store.GetAllEvents(); foreach (var e in events) { Console.WriteLine($"{e.Name}\t{e.Data}"); } }
public void it_should_return_an_empty_result_for_a_non_existant_event_source() { Assert.That(EventStore.GetAllEvents(Guid.NewGuid()), Is.Empty); }
public void SetUp() { BaseSetup(); _returnedEvents = EventStore.GetAllEvents(Source.EventSourceId).ToArray(); }