Пример #1
0
 public RepoWatcher(IGithubBrowser browser, Repo repoToWatch, IScheduler backgroundScheduler)
 {
     _timerDisposal = Observable
         .Interval(_defaultRefreshSpan, backgroundScheduler)
         .SelectMany(_ => browser.GetCommits(repoToWatch))
         .Subscribe(OnCommitsArrived);
 }
Пример #2
0
        public void Should_Get_Commits_Every_10_seconds()
        {
            var someRepo = new Repo();
            TestScheduler testScheduler = new TestScheduler();

            var sut = new RepoWatcher(_browserMock.Object, someRepo, testScheduler);
            _browserMock.Verify(x => x.GetCommits(someRepo), Times.Never);
            testScheduler.AdvanceBy(TimeSpan.FromSeconds(10).Ticks);

            _browserMock.Verify(x => x.GetCommits(someRepo), Times.Once);
        }
Пример #3
0
        public void RepoWatcherComponentDemo()
        {
            var someRepo = new Repo
            {
                CommitsUrl = new Uri("https://api.github.com/repos/nikodemrafalski/testrepo/commits{/sha}")
            };

            var watcher = new RepoWatcher(_githubBrowser, someRepo, TaskPoolScheduler.Default);
            watcher.NewCommits.Subscribe(c => Console.WriteLine("new commit! " + c.Sha + " " + c.CommitInfo.Message));
            Console.ReadKey();
        }
Пример #4
0
        public void Demo2()
        {
            var someRepo = new Repo
            {
                CommitsUrl = new Uri("https://api.github.com/repos/nikodemrafalski/testrepo/commits{/sha}")
            };

            _githubBrowser
                .GetCommits(someRepo)
                .Subscribe(v => { }, error => { }, () => { });
            Console.ReadKey();
        }
Пример #5
0
 public RepoModel(Repo repo)
 {
     Dto = repo;
 }
Пример #6
0
 public void WatchRepo(Repo repo)
 {
     RepoHubProxy.Invoke("WatchRepo", repo);
 }
Пример #7
0
 public async Task UnWatchRepo(Repo repo)
 {
     await Groups.Remove(Context.ConnectionId, repo.CommitsUrl.ToString().Replace("{/sha}", string.Empty));
 }       
Пример #8
0
 public async Task WatchRepo(Repo repo)
 {
     _repoWatch.WatchRepo(repo);
     await Groups.Add(Context.ConnectionId, repo.CommitsUrl.ToString().Replace("{/sha}", string.Empty));            
 }
Пример #9
0
        public void WatchRepoDemo()
        {
            var someRepo = new Repo
            {
                CommitsUrl = new Uri("https://api.github.com/repos/nikodemrafalski/testrepo/commits{/sha}")
            };

            _githubBrowser.NewCommitsFeed.Subscribe(c => Console.WriteLine("new commit! " + c.Sha + " " + c.CommitInfo.Message));
            Console.ReadKey();
            _githubBrowser.StartWatchingRepo(someRepo).Subscribe();
            Console.ReadKey();
            _githubBrowser.StopWatchingRepo(someRepo).Subscribe();
            Console.ReadKey();
        }
Пример #10
0
 public FavQuery(Repo repo)
     : base(null)
 {
     Repo = repo;
 }
Пример #11
0
 protected bool Equals(Repo other)
 {
     return Id == other.Id;
 }