protected override bool Match(TestTarget target, HttpRequestMessage request) { if (TestDefinition == null) { return true; } return cachedResults.GetOrAdd(target, t => target.ResolveDependency(TestDefinition.TestType) .IfTypeIs<IApplyToApplication>() .Then(test => test.AppliesToApplication(t.Application)) .Else(() => false)); }
protected override bool Match(TestTarget target, HttpRequestMessage request) { if (TestDefinition == null) { return(true); } return(cachedResults.GetOrAdd(target, t => target.ResolveDependency(TestDefinition.TestType) .IfTypeIs <IApplyToApplication>() .Then(test => test.AppliesToApplication(t.Application)) .Else(() => false))); }
protected override bool Match(TestTarget target, HttpRequestMessage request) { _tags = _tags ?? (_tags = target.ResolveDependency(TestDefinition.TestType) .IfTypeIs<IHaveTags>() .Then(test => { var tags = test.Tags; TestDefinition.Tags = tags; return tags; }) .ElseDefault() .OrEmpty() .ToArray()); return DoTestsMatchFilterRequest(_tags, request.GetQueryNameValuePairs().ToArray()); }
protected override bool Match(TestTarget target, HttpRequestMessage request) { _tags = _tags ?? (_tags = target.ResolveDependency(TestDefinition.TestType) .IfTypeIs <IHaveTags>() .Then(test => { var tags = test.Tags; TestDefinition.Tags = tags; return(tags); }) .ElseDefault() .OrEmpty() .ToArray()); return(DoTestsMatchFilterRequest(_tags, request.GetQueryNameValuePairs().ToArray())); }
protected override bool Match(TestTarget target, HttpRequestMessage request) { if (TestDefinition == null) { return(true); } var key = string.Format("{0}{1}:{2}:{3}", "TargetConstraint:", target.Environment, target.Application, TestDefinition.TestType); return(HttpRuntime.Cache.GetOrAdd(key, () => { var test = target.ResolveDependency(TestDefinition.TestType) as IApplyToTarget; return test.IfNotNull() .Then(t => t.AppliesToTarget(target)) .ElseDefault(); })); }
internal bool Match(TestTarget target) { if (TestDefinition == null) { return(true); } var key = string.Format("{0}({1}:{2}):{3}", "TargetConstraint:", target.Environment, target.Application, TestDefinition.TestType); Func <bool> resolve = () => { var test = target.ResolveDependency(TestDefinition.TestType); return(test.IfTypeIs <IApplyToTarget>() .Then(t => t.AppliesToTarget(target)) .ElseDefault()); }; return(HttpRuntime.Cache.GetOrAdd(key, resolve)); }
internal bool Match(TestTarget target) { if (TestDefinition == null) { return true; } var key = $"{"TargetConstraint:"}({target.Environment}:{target.Application}):{TestDefinition.TestType}"; Func<bool> resolve = () => { var test = target.ResolveDependency(TestDefinition.TestType); return test.IfTypeIs<IApplyToTarget>() .Then(t => t.AppliesToTarget(target)) .ElseDefault(); }; return HttpRuntime.Cache.GetOrAdd(key, resolve); }
protected abstract bool Match(TestTarget target, HttpRequestMessage request);
protected abstract bool Match(TestTarget target, HttpRequestMessage request);
protected override bool Match(TestTarget target, HttpRequestMessage _) { return(Match(target)); }
protected override bool Match(TestTarget target, HttpRequestMessage _) => Match(target);