예제 #1
0
        public void Setup()
        {
            _cacheProvider = new BasicCacher.BasicCacher();
            _logProvider = new SimpleLogProvider();

            var username = ConfigurationManager.AppSettings["username"];
            var password = ConfigurationManager.AppSettings["password"];
            _authProvider = new UserPasswordAuthProvider(username, password);
        }
    	public static API_GitHub_Objects login(this API_GitHub_Objects gitHubObjects , string name, string apiToken)
    	{
    		gitHubObjects.checkIfCanMakeRequest();
    		try
    		{	    		
	    		var Cache = new BasicCacher.BasicCacher(); 
				var Log = new SimpleLogProvider();
							 
				var user = new GitModel.GithubUser { Name = name, APIToken = apiToken };									
				gitHubObjects.ObjectsAPI = new GitAPI.Object(Cache, Log);
				gitHubObjects.ObjectsAPI.Authenticate(user);   
				gitHubObjects.LoggedIn = true;
			}
			catch(Exception ex)
			{
				"Error while logging in to GitHub using user {0}".info(name);
				ex.log("in API_GitHub_Objects.login");
			}
			return gitHubObjects;
    	}