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);
 }
Beispiel #3
0
        public void CustomContext()
        {
            var context = new GitHubApiContext();

            var api = new GitHubApi(context);

            api.Context.Should().BeSameAs(context);
        }
Beispiel #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;
     }
 }
 public SettingsViewModel(GitHubApi githubApi)
 {
     this.githubApi = githubApi;
     LoginCommand = new DelegateCommand<PasswordBox>(Login, p=>!LoggingIn);
     ClearLoginDetailsCommand = new DelegateCommand(ClearLoginDetails);
 }
Beispiel #6
0
 //[SetUp]
 public void CreateGitHubApi()
 {
     Api = GitHubApi.Create();
 }
Beispiel #7
0
 public void CreateGitHubApi()
 {
     Api = new GitHubApi();
 }
Beispiel #8
0
        public void DefaultContext()
        {
            var api = new GitHubApi();

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