当前位置: 首页>>代码示例>>C#>>正文


C# Tracker.TrackEcommerceTransaction方法代码示例

本文整理汇总了C#中Tracker.TrackEcommerceTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# Tracker.TrackEcommerceTransaction方法的具体用法?C# Tracker.TrackEcommerceTransaction怎么用?C# Tracker.TrackEcommerceTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracker的用法示例。


在下文中一共展示了Tracker.TrackEcommerceTransaction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testTrackEcommerceTransaction

        public void testTrackEcommerceTransaction()
        {
            using (Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create())
            {
                ShimHttpWebRequest.AllInstances.GetResponse = fake;

                var t = new Tracker(new Emitter("d3rkrsqld9gmqf.cloudfront.net"));
                var hat = new TransactionItem("pbz0026", 20, 1);
                var shirt = new TransactionItem("pbz0038", 15, 1, "shirt", "clothing");
                var items = new List<TransactionItem> { hat, shirt };
                t.TrackEcommerceTransaction("6a8078be", 35, "affiliation", 3, 0, "Phoenix", "Arizona", "US", "USD", items);
                var expectedTransaction = new Dictionary<string, string>
                {
                    {"e", "tr"},
                    {"tr_id", "6a8078be"},
                    {"tr_tt", "35"},
                    {"tr_af", "affiliation"},
                    {"tr_tx", "3"},
                    {"tr_sh", "0"},
                    {"tr_ci", "Phoenix"},
                    {"tr_st", "Arizona"},
                    {"tr_co", "US"},
                    {"tr_cu", "USD"}

                };
                var expectedHat = new Dictionary<string, string>
                {
                    {"e", "ti"},
                    {"ti_id", "6a8078be"},
                    {"ti_sk", "pbz0026"},
                    {"ti_pr", "20"},
                    {"ti_qu", "1"},
                    {"ti_cu", "USD"}
                };
                var expectedShirt = new Dictionary<string, string>
                {
                    {"e", "ti"},
                    {"ti_id", "6a8078be"},
                    {"ti_sk", "pbz0038"},
                    {"ti_pr", "15"},
                    {"ti_qu", "1"},
                    {"ti_nm", "shirt"},
                    {"ti_ca", "clothing"},
                    {"ti_cu", "USD"}
                };
                checkResult(expectedTransaction, payloads[payloads.Count - 3]);
                checkResult(expectedHat, payloads[payloads.Count - 2]);
                checkResult(expectedShirt, payloads[payloads.Count - 1]);
            }
        }
开发者ID:vantreeseba,项目名称:snowplow-dotnet-tracker,代码行数:50,代码来源:IntegrationTest.cs


注:本文中的Tracker.TrackEcommerceTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。