public void TestGetAuthorizationUrl() { MockAdsOAuthProviderImpl provider = new MockAdsOAuthProviderImpl(appConfig, newAppConfig); string temp; // Scope is a required parameter. temp = provider.Config.OAuth2Scope; provider.Config.OAuth2Scope = ""; Assert.Throws <ArgumentNullException>(delegate() { provider.GetAuthorizationUrl(); }); provider.Config.OAuth2Scope = temp; // RedirectUri is a required parameter. temp = provider.Config.OAuth2RedirectUri; provider.Config.OAuth2RedirectUri = ""; Assert.Throws <ArgumentNullException>(delegate() { provider.GetAuthorizationUrl(); }); provider.Config.OAuth2RedirectUri = temp; // Attempt a normal call, to validate the parameter passing. Assert.DoesNotThrow(delegate() { provider.GetAuthorizationUrl(); }); }
public void TestGetAuthorizationUrl_NoDuplicateParameters() { MockAdsOAuthProviderImpl provider = new MockAdsOAuthProviderImpl(appConfig, newAppConfig); Assert.AreEqual(1, Regex.Matches(provider.GetAuthorizationUrl(), "access_type=").Count); }