public void TestInitMinimal() { DesktopContext context = new DesktopContext().SetOsType("OS-X").SetOsVersion("10.10.5").Build(); Assert.NotNull(context); Dictionary <string, object> dict = context.GetData(); Assert.AreEqual(2, dict.Count); Assert.AreEqual("OS-X", dict [Constants.PLAT_OS_TYPE]); Assert.AreEqual("10.10.5", dict [Constants.PLAT_OS_VERSION]); Assert.AreEqual("iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0", context.GetSchema()); Assert.AreEqual("{\"data\":{\"osVersion\":\"10.10.5\", \"osType\":\"OS-X\"}, \"schema\":\"iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0\"}", context.GetJson().ToString()); }
public void TestInitFull() { DesktopContext context = new DesktopContext() .SetOsType("OS-X") .SetOsVersion("10.10.5") .SetOsServicePack("Yosemite") .SetOsIs64Bit(true) .SetDeviceManufacturer("Apple") .SetDeviceModel("Macbook Pro") .SetDeviceProcessorCount(4) .Build(); Assert.NotNull(context); Dictionary <string, object> dict = context.GetData(); Assert.AreEqual(7, dict.Count); Assert.AreEqual("OS-X", dict [Constants.PLAT_OS_TYPE]); Assert.AreEqual("10.10.5", dict [Constants.PLAT_OS_VERSION]); Assert.AreEqual("Yosemite", dict [Constants.DESKTOP_SERVICE_PACK]); Assert.AreEqual(true, dict [Constants.DESKTOP_IS_64_BIT]); Assert.AreEqual("Apple", dict [Constants.PLAT_DEVICE_MANU]); Assert.AreEqual("Macbook Pro", dict [Constants.PLAT_DEVICE_MODEL]); Assert.AreEqual(4, dict [Constants.DESKTOP_PROC_COUNT]); Assert.AreEqual("iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0", context.GetSchema()); Assert.AreEqual("{\"data\":{\"osVersion\":\"10.10.5\", \"osServicePack\":\"Yosemite\", \"deviceManufacturer\":\"Apple\", \"deviceProcessorCount\":4, \"osIs64Bit\":true, \"deviceModel\":\"Macbook Pro\", \"osType\":\"OS-X\"}, \"schema\":\"iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0\"}", context.GetJson().ToString()); }
public void testInitDesktopContext() { var dc = new DesktopContext() .SetOsType("Windows") .SetOsVersion("10") .SetOsServicePack("6") .SetOsIs64Bit(true) .SetDeviceManufacturer("Asus") .SetDeviceModel("unknown") .SetDeviceProcessorCount(8) .Build(); Assert.IsNotNull(dc); Assert.AreEqual(@"{""schema"":""iglu:com.snowplowanalytics.snowplow/desktop_context/jsonschema/1-0-0"",""data"":{""osType"":""Windows"",""osVersion"":""10"",""osServicePack"":""6"",""osIs64Bit"":true,""deviceManufacturer"":""Asus"",""deviceModel"":""unknown"",""deviceProcessorCount"":8}}", dc.GetJson().ToString()); }