public RepoWatcher(IGithubBrowser browser, Repo repoToWatch, IScheduler backgroundScheduler) { _timerDisposal = Observable .Interval(_defaultRefreshSpan, backgroundScheduler) .SelectMany(_ => browser.GetCommits(repoToWatch)) .Subscribe(OnCommitsArrived); }
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); }
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(); }
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(); }
public RepoModel(Repo repo) { Dto = repo; }
public void WatchRepo(Repo repo) { RepoHubProxy.Invoke("WatchRepo", repo); }
public async Task UnWatchRepo(Repo repo) { await Groups.Remove(Context.ConnectionId, repo.CommitsUrl.ToString().Replace("{/sha}", string.Empty)); }
public async Task WatchRepo(Repo repo) { _repoWatch.WatchRepo(repo); await Groups.Add(Context.ConnectionId, repo.CommitsUrl.ToString().Replace("{/sha}", string.Empty)); }
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(); }
public FavQuery(Repo repo) : base(null) { Repo = repo; }
protected bool Equals(Repo other) { return Id == other.Id; }