private void EnsurePackageHasUnacceptedScope(PluginDatabase db, string plugin, string scope)
 {
     if (String.IsNullOrEmpty(db.GetRequestToken(plugin)))
     {
         throw new Exception("invalid request token");
     }
     if (db.GetAccessToken(plugin) != null)
     {
         throw new Exception("invalid access token!");
     }
     if (db.GetPluginScopes(plugin).Count != 1)
     {
         throw new Exception("Unexpected scopes!");
     }
     if (db.GetPluginScopes(plugin).First() != scope)
     {
         throw new Exception("Unexpected scope in db!");
     }
 }
 private static void EnsurePackageDataIsEmpty(PluginDatabase db, string testPackageA)
 {
     if (String.IsNullOrEmpty(db.GetRequestToken(testPackageA)))
     {
         throw new Exception("invalid request token");
     }
     if (db.GetAccessToken(testPackageA) != null)
     {
         throw new Exception("invalid access token!");
     }
     if (db.GetPluginScopes(testPackageA).Count > 0)
     {
         throw new Exception("Unexpected scopes!");
     }
 }