public void ApiKeyHandler_TryParseAuthorizationHeader_InvalidHeaderValueThrows() { Assert.ThrowsException <System.ArgumentException>(() => { AuthorizationHeaderValue.TryParse(new Microsoft.Extensions.Primitives.StringValues(new string[] { "abc", "def" }), out AuthorizationHeaderValue foo); }); }
public void ApiKeyHandler_TryParseAuthorizationHeader_ValidHeaderValue() { var result = AuthorizationHeaderValue.TryParse(new Microsoft.Extensions.Primitives.StringValues(ValidHeaderValue), out AuthorizationHeaderValue output); Assert.IsTrue(result); Assert.AreEqual("key", output.AuthenticationType); Assert.AreEqual("app_name:key_value", output.Value); }