예제 #1
0
        public void TestInitFull()
        {
            ScreenView sv = new ScreenView().SetName("name").SetId("id").Build();
            Dictionary <string, object> payload = (Dictionary <string, object>)sv.GetPayload().GetDictionary()["data"];

            Assert.AreEqual(2, payload.Count);
            Assert.AreEqual("id", payload [Constants.SV_ID]);
            Assert.AreEqual("name", payload [Constants.SV_NAME]);
            Assert.AreEqual("iglu:com.snowplowanalytics.snowplow/screen_view/jsonschema/1-0-0", (string)sv.GetPayload().GetDictionary()["schema"]);
        }
        public void testInitScreenView()
        {
            var sv = new ScreenView()
                     .SetId("someId")
                     .SetName("someName")
                     .SetTrueTimestamp(123456789123)
                     .Build();

            var sdj = (SelfDescribingJson)sv.GetPayload();

            Assert.IsNotNull(sv);
            Assert.IsNotNull(sdj);
            Assert.AreEqual(@"{""schema"":""iglu:com.snowplowanalytics.snowplow/screen_view/jsonschema/1-0-0"",""data"":{""name"":""someName"",""id"":""someId""}}", sdj.ToString());
            Assert.IsNotNull(sv.GetContexts());
        }