Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 测试OAuth2令牌的路由注册码的合适方法是什么?_.net_Unit Testing_Asp.net Web Api - Fatal编程技术网

.net 测试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

我目前正在为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());
}

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

你有没有遇到过这位松鼠先生?目前,我在尝试访问令牌端点时遇到404个问题。