Пример #1
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);
        }
Пример #2
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();
        }
Пример #3
0
        public void Should_Get_Commits_Every_10_seconds()
        {
            var someRepo      = new Repo();
            var 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);
        }
Пример #4
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();
        }