public async Task PathBase_Added(string startValue, string pathBase, bool append, string expected) { var httpContext = new DefaultHttpContext(); httpContext.Request.PathBase = string.IsNullOrEmpty(pathBase) ? new PathString() : new PathString(pathBase); var proxyRequest = new HttpRequestMessage(); proxyRequest.Headers.Add("name", startValue.Split(";", StringSplitOptions.RemoveEmptyEntries)); var transform = new RequestHeaderXForwardedPathBaseTransform("name", append); await transform.ApplyAsync(new RequestTransformContext() { HttpContext = httpContext, ProxyRequest = proxyRequest, HeadersCopied = true, }); if (string.IsNullOrEmpty(expected)) { Assert.False(proxyRequest.Headers.TryGetValues("name", out var _)); } else { Assert.Equal(expected.Split(";", StringSplitOptions.RemoveEmptyEntries), proxyRequest.Headers.GetValues("name")); } }