예제 #1
0
 public void SetUp()
 {
     _oAuth     = Substitute.For <IGitHubOAuth>();
     _persister = Substitute.For <IGitHubUserPersister>();
     _userName  = "******";
     _token     = "token";
     _oAuth.Login().Returns(new GitHubUserCookie()
     {
         UserName = _userName,
         Token    = _token
     });
     _user = new GitHubUser(_oAuth, _persister);
 }
예제 #2
0
 public bool Login()
 {
     if (string.IsNullOrWhiteSpace(UserCookie?.Token))
     {
         UserCookie = OAuth.Login();
     }
     if (UserCookie == null)
     {
         return(false);
     }
     Persister.Save(this);
     return(true);
 }