public void AnalyticsVisitorIdentification_ShoudReturnEmptyString_TrackingIsFalse() { var htmlHelper = new HtmlHelper(new ViewContext(), new ViewPage()); var sitecoreHelper = new SitecoreHelper(htmlHelper); var result = sitecoreHelper.AnalyticsVisitorIdentification(); result.ToString().Should().Be(string.Empty); }
public void AnalyticsVisitorIdentification_ShoudReturnDebuggingMessage_WhenProfilingIsTrue() { var htmlHelper = new HtmlHelper(new ViewContext(), new ViewPage()); var sitecoreHelper = new SitecoreHelper(htmlHelper); var expectedResult = "<!-- Visitor identification is disabled because debugging is active. -->"; Context.Site = new FakeSiteContext("fake"); Profiler.StartSession(); Context.Diagnostics.Profiling = true; var result = sitecoreHelper.AnalyticsVisitorIdentification(); result.ToString().Should().Be(expectedResult); }
public void AnalyticsVisitorIdentification_ShoudReturnEmptyString_TrackingIsTrue() { var htmlHelper = new HtmlHelper(new ViewContext(), new ViewPage()); var sitecoreHelper = new SitecoreHelper(htmlHelper); var expectedResult = new HtmlString( "<link href=\"/layouts/System/VisitorIdentification.aspx\" rel=\"stylesheet\" type=\"text/css\" />") .ToString(); Context.Site = null; Context.Site = new FakeSiteContext("fake"); Tracer.EndSession(); Profiler.EndSession(); var emptySession = new EmptySession(); var tracker = new NullTracker(emptySession); Switcher <ITracker, TrackerSwitcher> .Enter(tracker); Tracker.Initialize(); Tracker.IsActive = true; var result = sitecoreHelper.AnalyticsVisitorIdentification(); result.ToString().Should().Be(expectedResult); }