public IWebRequestTracer TraceWebRequest(string url) { if (string.IsNullOrEmpty(url)) { logger.Warn($"{this} TraceWebRequest(string): url must not be null or empty"); return(NullWebRequestTracer.Instance); } if (!WebRequestTracer.IsValidUrlScheme(url)) { logger.Warn($"{this} TraceWebRequest(string): url \"{url}\" does not have a valid scheme"); return(NullWebRequestTracer.Instance); } if (logger.IsDebugEnabled) { logger.Debug($"{this} TraceWebRequest({url})"); } lock (lockObject) { if (isFinished) { return(NullWebRequestTracer.Instance); } var session = GetOrSplitCurrentSessionByEvents(); RecordTopLevelEventInteraction(); return(session.TraceWebRequest(url)); } }
public void AValidSchemeDoesNotStartWithADigit() { // when it does not start with a digit, then it's valid Assert.That(WebRequestTracer.IsValidUrlScheme("a1://some.host"), Is.True); // when it starts with a digit, then it's invalid Assert.That(WebRequestTracer.IsValidUrlScheme("1a://some.host"), Is.False); }
public IWebRequestTracer TraceWebRequest(string url) { if (string.IsNullOrEmpty(url)) { Logger.Warn($"{this} TraceWebRequest (String): url must not be null or empty"); return(NullWebRequestTracer.Instance); } if (!WebRequestTracer.IsValidUrlScheme(url)) { Logger.Warn($"{this} TraceWebRequest (String): url \"{url}\" does not have a valid scheme"); return(NullWebRequestTracer.Instance); } if (Logger.IsDebugEnabled) { Logger.Debug($"{this} TraceWebRequest(${url})"); } lock (LockObject) { if (!ThisAction.IsActionLeft) { var tracer = new WebRequestTracer(Logger, this, Beacon, url); ThisComposite.StoreChildInList(tracer); return(tracer); } } return(NullWebRequestTracer.Instance); }
public void ASchemeIsInvalidIfInvalidCharactersAreEncountered() { // then Assert.That(WebRequestTracer.IsValidUrlScheme("a()[]{}@://some.host"), Is.False); }
public void AValidSchemeAllowsUpperCaseLettersToo() { // when the url scheme contains all allowed characters Assert.That(WebRequestTracer.IsValidUrlScheme("Obp1e+nZK6i.t-://some.host"), Is.True); }
public void AValidSchemeOnlyContainsLettersDigitsPlusPeriodOrHyphen() { // when the url scheme contains all allowed characters Assert.That(WebRequestTracer.IsValidUrlScheme("b1+Z6.-://some.host"), Is.True); }
public void AValidSchemeStartsWithALetter() { // when starting with lower case letter, then Assert.That(WebRequestTracer.IsValidUrlScheme("a://some.host"), Is.True); }
public void NullIsNotAValidUrlScheme() { // then Assert.That(WebRequestTracer.IsValidUrlScheme(null), Is.False); }