.net 测试OAuth2令牌的路由注册码的合适方法是什么?
我目前正在为OAuth2身份验证代码编写一个包装器,它要求在应用程序启动时调用以下函数:.net 测试OAuth2令牌的路由注册码的合适方法是什么?,.net,unit-testing,asp.net-web-api,.net,Unit Testing,Asp.net Web Api,我目前正在为OAuth2身份验证代码编写一个包装器,它要求在应用程序启动时调用以下函数: public static void RegisterServer(IAppBuilder app, OAuthServerProvider provider) { // Generate the tokens for the application app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions
public static void RegisterServer(IAppBuilder app, OAuthServerProvider provider)
{
// Generate the tokens for the application
app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions
{
// Require the use of HTTPS, this will cause a 404 error over HTTP
AllowInsecureHttp = true,
TokenEndpointPath = new PathString("/token"),
AccessTokenExpireTimeSpan = TimeSpan.FromHours(8),
Provider = provider
});
// Enable the token consumption
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
什么是适当的技术来单元测试此函数,以确保令牌端点已正确注册?或者,这是不是应该局限于更大规模的功能测试?你有没有遇到过这位松鼠先生?目前,我在尝试访问令牌端点时遇到404个问题。