private static void AssertEventInfo(TimelineEvent @event) { NUnit.Framework.Assert.IsNotNull(@event); NUnit.Framework.Assert.IsNotNull(@event.GetEventInfoJAXB()); NUnit.Framework.Assert.IsTrue(@event.GetEventInfo() is Hashtable); NUnit.Framework.Assert.IsTrue(@event.GetEventInfoJAXB() is Hashtable); NUnit.Framework.Assert.AreEqual(@event.GetEventInfo(), @event.GetEventInfoJAXB()); }
public virtual void TestEvents() { TimelineEvents events = new TimelineEvents(); for (int j = 0; j < 2; ++j) { TimelineEvents.EventsOfOneEntity partEvents = new TimelineEvents.EventsOfOneEntity (); partEvents.SetEntityId("entity id " + j); partEvents.SetEntityType("entity type " + j); for (int i = 0; i < 2; ++i) { TimelineEvent @event = new TimelineEvent(); @event.SetTimestamp(Runtime.CurrentTimeMillis()); @event.SetEventType("event type " + i); @event.AddEventInfo("key1", "val1"); @event.AddEventInfo("key2", "val2"); partEvents.AddEvent(@event); } events.AddEvent(partEvents); } Log.Info("Events in JSON:"); Log.Info(TimelineUtils.DumpTimelineRecordtoJSON(events, true)); NUnit.Framework.Assert.AreEqual(2, events.GetAllEvents().Count); TimelineEvents.EventsOfOneEntity partEvents1 = events.GetAllEvents()[0]; NUnit.Framework.Assert.AreEqual("entity id 0", partEvents1.GetEntityId()); NUnit.Framework.Assert.AreEqual("entity type 0", partEvents1.GetEntityType()); NUnit.Framework.Assert.AreEqual(2, partEvents1.GetEvents().Count); TimelineEvent event11 = partEvents1.GetEvents()[0]; NUnit.Framework.Assert.AreEqual("event type 0", event11.GetEventType()); NUnit.Framework.Assert.AreEqual(2, event11.GetEventInfo().Count); TimelineEvent event12 = partEvents1.GetEvents()[1]; NUnit.Framework.Assert.AreEqual("event type 1", event12.GetEventType()); NUnit.Framework.Assert.AreEqual(2, event12.GetEventInfo().Count); TimelineEvents.EventsOfOneEntity partEvents2 = events.GetAllEvents()[1]; NUnit.Framework.Assert.AreEqual("entity id 1", partEvents2.GetEntityId()); NUnit.Framework.Assert.AreEqual("entity type 1", partEvents2.GetEntityType()); NUnit.Framework.Assert.AreEqual(2, partEvents2.GetEvents().Count); TimelineEvent event21 = partEvents2.GetEvents()[0]; NUnit.Framework.Assert.AreEqual("event type 0", event21.GetEventType()); NUnit.Framework.Assert.AreEqual(2, event21.GetEventInfo().Count); TimelineEvent event22 = partEvents2.GetEvents()[1]; NUnit.Framework.Assert.AreEqual("event type 1", event22.GetEventType()); NUnit.Framework.Assert.AreEqual(2, event22.GetEventInfo().Count); }