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


C# Tracker.Flush方法代码示例

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


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

示例1: testAsyncPostOnSuccess

 public void testAsyncPostOnSuccess()
 {
     using (Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create())
     {
         ShimHttpWebRequest.AllInstances.GetResponse = fake;
         int successes = -1;
         var e = new AsyncEmitter("d3rkrsqld9gmqf.cloudfront.net", HttpProtocol.HTTP, null, HttpMethod.POST, 10, (successCount) =>
         {
             successes = successCount;
         });
         var t = new Tracker(e);
         t.TrackPageView("first");
         t.TrackPageView("second");
         t.Flush(true);
         Assert.AreEqual(2, successes);
     }
 }
开发者ID:vantreeseba,项目名称:snowplow-dotnet-tracker,代码行数:17,代码来源:IntegrationTest.cs

示例2: testAsyncPostOnFailure

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

                int? successes = null;
                List<Dictionary<string, string>> failureList = null;
                var e = new AsyncEmitter("d3rkrsqld9gmqf.cloudfront.net", HttpProtocol.HTTP, null, HttpMethod.POST, 10, null, (successCount, failures) =>
                {
                    successes = successCount;
                    failureList = failures;
                });
                var t = new Tracker(e);
                t.TrackPageView("first");
                t.TrackPageView("second");
                t.Flush(true);
                Assert.AreEqual(0, successes);
                Assert.AreEqual("first", failureList[0]["url"]);
                Assert.AreEqual("second", failureList[1]["url"]);
            }
        }
开发者ID:vantreeseba,项目名称:snowplow-dotnet-tracker,代码行数:22,代码来源:IntegrationTest.cs

示例3: testAsyncTrackPageView

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

                var t = new Tracker(new AsyncEmitter("d3rkrsqld9gmqf.cloudfront.net"));
                t.TrackPageView("http://www.example.com", "title page", "http://www.referrer.com");
                var expected = new Dictionary<string, string>
                {
                    {"e", "pv"},
                    {"url", "http://www.example.com"},
                    {"page", "title page"},
                    {"refr", "http://www.referrer.com"}
                };
                t.Flush(true);
                checkResult(expected, payloads[payloads.Count - 1]);
            }
        }
开发者ID:vantreeseba,项目名称:snowplow-dotnet-tracker,代码行数:19,代码来源:IntegrationTest.cs


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