本文整理汇总了C#中Tracker.SetLang方法的典型用法代码示例。如果您正苦于以下问题:C# Tracker.SetLang方法的具体用法?C# Tracker.SetLang怎么用?C# Tracker.SetLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker
的用法示例。
在下文中一共展示了Tracker.SetLang方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testTrackerSetterMethods
public void testTrackerSetterMethods()
{
var subjectOne = new Subject();
var subjectTwo = new Subject();
var tracker = new Tracker(new Emitter("d3rkrsqld9gmqf.cloudfront.net"), subjectOne);
tracker.SetPlatform(Platform.Mob);
tracker.SetUserId("malcolm");
tracker.SetScreenResolution(100, 200);
tracker.SetViewport(50, 60);
tracker.SetColorDepth(24);
tracker.SetTimezone("Europe London");
tracker.SetLang("en");
tracker.SetSubject(subjectTwo);
tracker.SetUserId("6561");
tracker.SetLang("fr");
tracker.SetScreenResolution(150, 250);
var expectedOne = new Dictionary<string, string>
{
{"p", "mob"},
{"uid", "malcolm"},
{"res", "100x200"},
{"vp", "50x60"},
{"cd", "24"},
{"tz", "Europe London"},
{"lang", "en"},
};
var expectedTwo = new Dictionary<string, string>
{
{"p", "pc"},
{"res", "150x250"},
{"lang", "fr"},
};
foreach (string key in expectedOne.Keys)
{
Assert.AreEqual(subjectOne.nvPairs[key], expectedOne[key]);
}
foreach (string key in expectedTwo.Keys)
{
Assert.AreEqual(subjectTwo.nvPairs[key], expectedTwo[key]);
}
}
示例2: testSetterMethods
public void testSetterMethods()
{
using (Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create())
{
ShimHttpWebRequest.AllInstances.GetResponse = fake;
var t = new Tracker(new Emitter("d3rkrsqld9gmqf.cloudfront.net"), null, "cf", "train simulator");
t.SetPlatform(Platform.Mob);
t.SetUserId("malcolm");
t.SetScreenResolution(100, 200);
t.SetViewport(50, 60);
t.SetColorDepth(24);
t.SetTimezone("Europe London");
t.SetLang("en");
t.TrackPageView("http://www.example.com", "title page", "http://www.referrer.com", null, 1000000000000);
var expected = new Dictionary<string, string>
{
{"e", "pv"},
{"url", "http://www.example.com"},
{"page", "title page"},
{"refr", "http://www.referrer.com"},
{"tv", Version.VERSION},
{"tna", "cf"},
{"aid", "train simulator"},
{"p", "mob"},
{"res", "100x200"},
{"vp", "50x60"},
{"cd", "24"},
{"tz", "Europe London"},
{"lang", "en"},
{"dtm", "1000000000000"}
};
checkResult(expected, payloads[payloads.Count - 1]);
}
}