public void TestGetHostContext(string queryString, string expectedToken) { var message = new OpenConnectionMessage(Guid.NewGuid().ToString("N"), new Claim[] { new Claim(ClaimTypes.Name, "user1") }, new Dictionary <string, StringValues> { ["custom1"] = "value1" } , queryString); var response = new MemoryStream(); var context = _clientConnectionManager.GetHostContext(message, response); Assert.Equal(200, context.Response.StatusCode); Assert.Equal("", ClientConnectionManager.GetContentAndDispose(response)); Assert.Equal("value1", context.Request.Headers["custom1"]); Assert.Equal(expectedToken, context.Request.QueryString["connectionToken"]); }