public CreateIssueViewModel(GitHubApi githubApi, IGitHubSettings settings)
 {
     this.githubApi = githubApi;
     this.settings = settings;
     Repositories = new ObservableCollection<RepositoryModel>();
     CreateIssueCommand = new DelegateCommand(CreateIssue);
 }
 public SettingsViewModel(GitHubApi githubApi, IGitHubSettings settings)
 {
     this.githubApi = githubApi;
     this.settings = settings;
     LoginCommand = new DelegateCommand<PasswordBox>(Login, p => !LoggingIn);
     CancelCommand = new DelegateCommand(() => OnClose());
     ClearLoginDetailsCommand = new DelegateCommand(ClearLoginDetails);
 }
示例#3
0
        public void CustomContext()
        {
            var context = new GitHubApiContext();

            var api = new GitHubApi(context);

            api.Context.Should().BeSameAs(context);
        }
示例#4
0
 async public static Task Auth(string accountName, GitHubApi api, IEnumerable<Scopes> scopes = null, string note = null)
 {
     var account = Load(accountName);
     var auth = account.Authorizations.FirstOrDefault(x => x.Scopes.Matches(scopes));
     if (auth == null)
     {
         auth = await api.Authorize(account.Credential, scopes, note);
         auth.Invalidated += account.OnAuthorizationInvalidated;
         account.Authorizations.Add(auth);
         account.Save();
     }
     else
     {
         api.Context.Authorize(auth);
         auth.Invalidated += account.OnAuthorizationInvalidated;
     }
 }
示例#5
0
 public SettingsViewModel(GitHubApi githubApi)
 {
     this.githubApi = githubApi;
     LoginCommand = new DelegateCommand<PasswordBox>(Login, p=>!LoggingIn);
     ClearLoginDetailsCommand = new DelegateCommand(ClearLoginDetails);
 }
示例#6
0
 //[SetUp]
 public void CreateGitHubApi()
 {
     Api = GitHubApi.Create();
 }
示例#7
0
 public void CreateGitHubApi()
 {
     Api = new GitHubApi();
 }
示例#8
0
        public void DefaultContext()
        {
            var api = new GitHubApi();

            api.Context.Should().BeOfType<GitHubApiContext>();
        }