我目前正在使用OAuth2身份验证代码的包装器,该代码需要在应用程序启动时调用以下函数:
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());
}
对单元测试此函数以确保令牌端点正确注册的适当技术是什么?或者,这是否应该限于更大规模的功能测试?