public void Create_PageViewHit_All_Validate_Values() { var hit = new ScreenViewHit(ScreenName); Assert.Equal(ScreenName, hit.ScreenName); Assert.Equal(HitType, hit.HitType, true); }
public void Create_ScreenViewHit_Validate_Fail() { var hit = new ScreenViewHit(ScreenName); hit.ScreenName = null; Assert.False(hit.Validate()); }
public static async Task <bool> SendAsync(ITracker tracker, string screenName) { var hit = new ScreenViewHit(screenName) { DataSource = "app", UserAgentOverride = @"Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19" }; // create the hit request. var request = (HitRequestBase)tracker.CreateHitRequest(hit); // Run a debug check to ensure its valid. var debugResponse = await request.ExecuteDebugAsync(); if (!((DebugResult)debugResponse).IsValid()) { return(false); } // Send hit. var collectRequest = await request.ExecuteCollectAsync(); Console.Write(collectRequest.RawResponse); return(true); }
public void TestMethod1() { var tracker = TrackerBuilder.BuildWebTracker(WebPropertyId); var pageHit = new PageViewHit("X"); var request = tracker.CreateHitRequest(pageHit); //var results = requset.ExecuteAsync(); // todo get awaiter var x = new ScreenViewHit("test"); var m = x.BuildPropertyString("ProtocolVersion"); Assert.True(x.ProtocolVersion != null); }
public void TestMethod1() { var tracker = Tracker.BuildWebTracker("XXX-0000-XXX"); var pageHit = new PageViewHit("X"); var requset = tracker.CreateDebugRequest(pageHit); var results = requset.ExecuteAsync(); // todo get awaiter var x = new ScreenViewHit("test"); var m = x.BuildPropertyString("ProtocolVersion"); Assert.IsNotNull(x.ProtocolVersion); }
public static bool Send(ITracker tracker) { var hit = new ScreenViewHit("Home") { UserId = "123456", DataSource = "app", GeographicalOverride = "US", IpOverride = "1.1.1.1", UserAgentOverride = "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14", ScreenResolution = "100x100", ViewportSize = "50x50", DocumentEncoding = "UTF-8", ScreenColors = "24-bits", // System info UserLanguage = "de-CH", JavaEnabled = "1", FlashVersion = "10 1 r103" }; var request = (HitRequestBase)tracker.CreateHitRequest(hit); var debugResponse = Task.Run(() => request.ExecuteDebugAsync()); debugResponse.Wait(); Console.Write(debugResponse.Result.RawResponse); var response = (DebugResult)debugResponse.Result; if (!response.Response.hitParsingResult.FirstOrDefault().valid) { return(false); } Console.Write(response.Response.hitParsingResult.FirstOrDefault().valid); var collectRequest = Task.Run(() => request.ExecuteCollectAsync()); collectRequest.Wait(); Console.Write(collectRequest.Result.RawResponse); return(true); }
public void Create_ScreenViewHit_All_Validate_Success() { var hit = new ScreenViewHit(ScreenName); Assert.True(hit.Validate()); }