public void ShouldTrace_HealthCheck_Fallback_UseFunc()
        {
            var request = CreateRequest("/this/path");
            Func <HttpRequest, bool?> fallback = (HttpRequest r) => true;
            var predicate = TraceDecisionPredicate.Create(fallback);

            Assert.True(predicate.ShouldTrace(request));
        }
        public void ShouldTrace_NoHealthCheck_Fallback(bool?returnValue)
        {
            var request = CreateRequest("/_ah/health");
            Func <HttpRequest, bool?> fallback = (HttpRequest r) => returnValue;
            var predicate = TraceDecisionPredicate.Create(fallback, ignoreHealthChecks: false);

            Assert.Equal(returnValue, predicate.ShouldTrace(request));
        }
        public void No_Trace()
        {
            var predicate = TraceDecisionPredicate.Create((req) => false);

            using (var cloudTrace = CloudTrace.InitializeInternal(new HttpApplication(),
                                                                  projectId: _projectId, options: _noBuffer, traceFallbackPredicate: predicate))
            {
                cloudTrace.BeginRequest(null, null);
                cloudTrace.EndRequest(null, null);
            }

            var trace = _polling.GetTrace($"/{_testId}", _startTime, false);

            Assert.Null(trace);
        }
Esempio n. 4
0
 public override TraceDecisionPredicate GetTraceDecisionPredicate() => TraceDecisionPredicate.Create(request => request.Path.ToString().Contains("fallback"));