public void testInitSelfDescribing() { var sdj = new SelfDescribingJson("iglu:com.acme/some_event/jsonschema/1-0-0", new Dictionary <string, string> { { "hello", "world" } }); var sd = new SelfDescribing() .SetEventData(sdj) .SetTrueTimestamp(123456789123) .Build(); Assert.IsNotNull(sd); Assert.AreEqual(Constants.EVENT_UNSTRUCTURED, sd.GetPayload().Payload[Constants.EVENT]); Assert.AreEqual(@"{""schema"":""iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0"",""data"":{""schema"":""iglu:com.acme/some_event/jsonschema/1-0-0"",""data"":{""hello"":""world""}}}", sd.GetPayload().Payload[Constants.UNSTRUCTURED]); sd.SetBase64Encode(true); Assert.AreEqual("eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvdy91bnN0cnVjdF9ldmVudC9qc29uc2NoZW1hLzEtMC0wIiwiZGF0YSI6eyJzY2hlbWEiOiJpZ2x1OmNvbS5hY21lL3NvbWVfZXZlbnQvanNvbnNjaGVtYS8xLTAtMCIsImRhdGEiOnsiaGVsbG8iOiJ3b3JsZCJ9fX0=", sd.GetPayload().Payload[Constants.UNSTRUCTURED_ENCODED]); Assert.IsNotNull(sd.GetContexts()); Assert.IsTrue(sd.GetPayload().Payload.ContainsKey(Constants.EID)); Assert.IsTrue(sd.GetPayload().Payload.ContainsKey(Constants.TIMESTAMP)); Assert.IsTrue(sd.GetPayload().Payload.ContainsKey(Constants.TRUE_TIMESTAMP)); }