测试OAuth2令牌的此路由注册代码的适当方法是什么?

时间:2014-04-01 15:28:39

标签: .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
    {
        // 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());
}

对单元测试此函数以确保令牌端点正确注册的适当技术是什么?或者,这是否应该限于更大规模的功能测试?

0 个答案:

没有答案