public async Task CanGetAllForCurrent() { var repositories = await _fixture.GetAllForCurrent(); Assert.NotEmpty(repositories); var repo = repositories.FirstOrDefault(repository => repository.Owner.Login == _repositoryContext.RepositoryOwner && repository.Name == _repositoryContext.RepositoryName); Assert.NotNull(repo); }
public HomeViewModel(IScreen host, IGitHubClient GHClient) { HostScreen = host; // Default to the normal (read: "tacky") user name if (GHClient.Connection.Credentials.Login == null) { UserName = UnknownUser; } //try //{ // var creds = GHClient.Connection.Credentials; // Debug.Print("Current user: {0}", creds.Login.ToString()); // if (GHClient.Connection.Credentials.Login != null) // { // UserName = GHClient.Connection.Credentials.Login; // } // else // { // UserName = UnknownUser; // } //} //catch (Exception ex) //{ // Debug.Print(ex.Message); // UserName = UnknownUser; //} var loggedIn = this.WhenAny(x => x.UserName, x => x.Value == UnknownUser); // Log in is necessary if the anonymous user text is the current user name LogIn = new ReactiveCommand(loggedIn); SClient = GHClient.Activity.Starring; var starredRepos = SClient.GetAllForCurrent().Result .Select(star => new StarRowViewModel(star)).ToArray(); Stars = new ReactiveList <StarRowViewModel>(starredRepos); //todo: once i get this working we can use actual log ins //IObservable<User> user = BlobCache.UserAccount.GetOrCreateObject<User>("MyUser", () => //{ // return null; //}); //user.Subscribe(u => // { // if (u == null) // { // UserName = "******"; // } // else // { // UserName = u.Login; // } // }); }
public HomeViewModel(IScreen host, IGitHubClient GHClient) { HostScreen = host; // Default to the normal (read: "tacky") user name if (GHClient.Connection.Credentials.Login == null) { UserName = UnknownUser; } //try //{ // var creds = GHClient.Connection.Credentials; // Debug.Print("Current user: {0}", creds.Login.ToString()); // if (GHClient.Connection.Credentials.Login != null) // { // UserName = GHClient.Connection.Credentials.Login; // } // else // { // UserName = UnknownUser; // } //} //catch (Exception ex) //{ // Debug.Print(ex.Message); // UserName = UnknownUser; //} var loggedIn = this.WhenAny(x => x.UserName, x => x.Value == UnknownUser); // Log in is necessary if the anonymous user text is the current user name LogIn = new ReactiveCommand(loggedIn); SClient = GHClient.Activity.Starring; var starredRepos = SClient.GetAllForCurrent().Result .Select(star => new StarRowViewModel(star)).ToArray(); Stars = new ReactiveList<StarRowViewModel>(starredRepos); //todo: once i get this working we can use actual log ins //IObservable<User> user = BlobCache.UserAccount.GetOrCreateObject<User>("MyUser", () => //{ // return null; //}); //user.Subscribe(u => // { // if (u == null) // { // UserName = "******"; // } // else // { // UserName = u.Login; // } // }); }