public void GrantResourceOwnerCredentials_ValidCredentials() { IOwinContext owinContext = new OwinContext(); OAuthAuthorizationServerOptions OAuthOptions = setUpOAuthOptions(); IList<string> scope = new List<string>(); OAuthGrantResourceOwnerCredentialsContext context = new OAuthGrantResourceOwnerCredentialsContext(owinContext, OAuthOptions, "", "useofforce", "123abc", scope); AnetMerchantOAuth merchantAuth = new AnetMerchantOAuth("self"); merchantAuth.GrantResourceOwnerCredentials(context); Assert.AreEqual(context.IsValidated, true); }
public void GrantResourceOwnerCredentials_EmptyCredentials() { IOwinContext owinContext = new OwinContext(); OAuthAuthorizationServerOptions OAuthOptions = setUpOAuthOptions(); IList<string> scope = new List<string>(); OAuthGrantResourceOwnerCredentialsContext context = new OAuthGrantResourceOwnerCredentialsContext(owinContext, OAuthOptions, "", "", "", scope); AnetMerchantOAuth merchantAuth = new AnetMerchantOAuth("self"); merchantAuth.GrantResourceOwnerCredentials(context); Assert.AreEqual(context.IsValidated, false); Assert.AreEqual(context.Error, "invalid_grant"); Assert.AreEqual(context.ErrorDescription, "The user name or password is incorrect."); }