예제 #1
0
 public async void ShouldCheckStarredAndWatchedStatusOnRefresh()
 {
     var vm = new RepositoryViewModel(Owner, Repo);
     GitHubClientMock.Verify(m => m.Activity.Starring.CheckStarred(Owner, Repo), Times.Once());
     GitHubClientMock.Verify(m => m.Activity.Watching.CheckWatched(Owner, Repo), Times.Once());
     
     // should also check on refresh
     await vm.Refresh();
     GitHubClientMock.Verify(m => m.Activity.Starring.CheckStarred(Owner, Repo), Times.Exactly(2));
     GitHubClientMock.Verify(m => m.Activity.Watching.CheckWatched(Owner, Repo), Times.Exactly(2));
 }
예제 #2
0
        public async void RepoVMShouldRefreshChildVMs()
        {
            var vm = new RepositoryViewModel(Owner, Repo);

            var prsMock = new Mock<RepositoryPullRequestsViewModel>(Owner, Repo);
            var issuesMock = new Mock<RepositoryIssuesViewModel>(Owner, Repo);
            var commitsMock = new Mock<RepositoryCommitsViewModel>(Owner, Repo);
            prsMock.Setup(m => m.Refresh()).Returns(() => Task.Run(() => { }));
            issuesMock.Setup(m => m.Refresh()).Returns(() => Task.Run(() => { }));
            commitsMock.Setup(m => m.Refresh()).Returns(() => Task.Run(() => { }));

            vm.IssuesViewModel = issuesMock.Object;
            vm.PullRequestsViewModel = prsMock.Object;
            vm.CommitsViewModel = commitsMock.Object;
            await vm.Refresh();

            prsMock.Verify(m => m.Refresh(), Times.Once());
            prsMock.Verify(m => m.Refresh(), Times.Once());
            prsMock.Verify(m => m.Refresh(), Times.Once());
        }