/// <summary> /// Track a new event /// </summary> /// <returns>The response from mixpanel</returns> /// <param name="profile">Profile.</param> /// <param name="mixpanelEvent">Mixpanel event.</param> public Task <MixpanelResponse> Track(Profile profile, IMixpanelEvent mixpanelEvent) { if (mixpanelEvent == null) { throw new ArgumentNullException(nameof(mixpanelEvent)); } var eventName = mixpanelEvent.EventName; var properties = MixpanelEventConverter.ToDictionary(mixpanelEvent); return(Track(profile, eventName, properties)); }
public void ConvertSimpleEventTest() { var evt = new SampleMixpanelEvent(); var dict = MixpanelEventConverter.ToDictionary(evt); Assert.AreEqual(5, dict.Count); Assert.IsTrue(dict.ContainsKey("Int Property")); Assert.AreEqual(100, dict ["Int Property"]); Assert.IsTrue(dict.ContainsKey("Float Property")); Assert.AreEqual(1.234f, dict ["Float Property"]); Assert.IsTrue(dict.ContainsKey("the bool property")); Assert.AreEqual(false, dict ["the bool property"]); Assert.IsTrue(dict.ContainsKey("double field")); Assert.AreEqual(2.0d, dict ["double field"]); Assert.IsTrue(dict.ContainsKey("Long Field")); Assert.AreEqual(100L, dict ["Long Field"]); }