Пример #1
0
        public MainViewModel()
        {
            NotificationsViewModel = new NotificationsViewModel();
            NewsViewModel = new NewsViewModel();
            ReposViewModel = new UserRepositoriesViewModel();
            IssuesViewModel = new UserIssuesViewModel();

            this.Refresh();

            GetCurrentUser();
        }
Пример #2
0
        public async void RepoVMShouldGetOwnedStarredAndWatched()
        {
            GitHubClientMock.Setup(m => m.Repository.GetAllForCurrent())
                .Returns(() => Task.FromResult(new List<Repository> {new Repository()} as IReadOnlyList<Repository>));
            GitHubClientMock.Setup(m => m.Activity.Starring.GetAllForCurrent())
                .Returns(() => Task.FromResult(new List<Repository> { new Repository() } as IReadOnlyList<Repository>));
            GitHubClientMock.Setup(m => m.Activity.Watching.GetAllForCurrent())
                .Returns(() => Task.FromResult(new List<Repository> { new Repository() } as IReadOnlyList<Repository>));

            var vm = new UserRepositoriesViewModel();
            await vm.Refresh();
            GitHubClientMock.Verify(m => m.Repository.GetAllForCurrent(), Times.Once());
            GitHubClientMock.Verify(m => m.Activity.Starring.GetAllForCurrent(), Times.Once());
            GitHubClientMock.Verify(m => m.Activity.Watching.GetAllForCurrent(), Times.Once());
            Assert.AreEqual(1, vm.OwnedRepos.Count);
            Assert.AreEqual(1, vm.StarredRepos.Count);
            Assert.AreEqual(1, vm.WatchedRepos.Count);
        }