public void TestInitMinimal() { EcommerceTransactionItem eti = new EcommerceTransactionItem().SetSku("sku").SetPrice(10.2).SetQuantity(1).Build(); Assert.NotNull(eti); Dictionary <string, object> payload = eti.GetPayload().GetDictionary(); Assert.AreEqual(6, payload.Count); Assert.AreEqual("ti", payload [Constants.EVENT]); Assert.AreEqual("sku", payload [Constants.TI_ITEM_SKU]); Assert.AreEqual("10.20", payload [Constants.TI_ITEM_PRICE]); Assert.AreEqual("1", payload [Constants.TI_ITEM_QUANTITY]); }
public void testInitEcommerceTransactionItem() { var eti = new EcommerceTransactionItem() .SetSku("sku") .SetPrice(20.1) .SetQuantity(5) .SetName("name") .SetCategory("category") .SetTrueTimestamp(123456789123) .Build(); eti.SetItemId("itemId"); eti.SetCurrency("AUD"); Assert.IsNotNull(eti); Assert.AreEqual(Constants.EVENT_ECOMM_ITEM, eti.GetPayload().Payload[Constants.EVENT]); Assert.AreEqual("itemId", eti.GetPayload().Payload[Constants.TI_ITEM_ID]); Assert.AreEqual("sku", eti.GetPayload().Payload[Constants.TI_ITEM_SKU]); Assert.AreEqual("name", eti.GetPayload().Payload[Constants.TI_ITEM_NAME]); Assert.AreEqual("category", eti.GetPayload().Payload[Constants.TI_ITEM_CATEGORY]); Assert.AreEqual("20.10", eti.GetPayload().Payload[Constants.TI_ITEM_PRICE]); Assert.AreEqual("5", eti.GetPayload().Payload[Constants.TI_ITEM_QUANTITY]); Assert.AreEqual("AUD", eti.GetPayload().Payload[Constants.TI_ITEM_CURRENCY]); Assert.IsNotNull(eti.GetContexts()); Assert.IsTrue(eti.GetPayload().Payload.ContainsKey(Constants.EID)); Assert.IsTrue(eti.GetPayload().Payload.ContainsKey(Constants.TIMESTAMP)); Assert.IsTrue(eti.GetPayload().Payload.ContainsKey(Constants.TRUE_TIMESTAMP)); }