public async void ShouldSaveCommentsBeforeRetrieveDiff()
        {
            await _mainWindowVm.RetrieveDiffs();

            _commentsPersist.ClearReceivedCalls();

            var pr = PullRequestLocator.FromUrl("https://github.com/owner/newrepo1/pull/122");

            _mainWindowVm.PullRequestLocator = pr;
            var expectedCommentsContainer = CommentsContainer.From(_mainWindowVm.Diffs, _mainWindowVm.GeneralComments);

            try
            {
                await _mainWindowVm.RetrieveDiffs();
            }
            catch
            {
                // ignored
            }

            _commentsPersist.Received(1)
            .Save(_pullRequestLocator,
                  Arg.Is <CommentsContainer>(x => x.Equals(expectedCommentsContainer)))
            .IgnoreAsyncWarning();
        }
        public void CanProcessHttpAsWellAsHttps()
        {
            var locator = PullRequestLocator.FromUrl(@"Http://github.com/EbenZhang/EZPlayer/pull/183");

            Assert.That(locator.Owner, Is.EqualTo("EbenZhang"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(183));
        }
        public void GivenAUrlWithNoProtocol_ShouldParseCorretly()
        {
            var locator = PullRequestLocator.FromUrl(@"github.com/EbenZhang/EZPlayer/pull/183");

            Assert.That(locator.Owner, Is.EqualTo("EbenZhang"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(183));
        }
        public void GivenAValidUrl_ShouldParseCorrectly()
        {
            var locator = PullRequestLocator.FromUrl(@"https://github.com/EbenZhang/EZPlayer/pull/183");

            Assert.That(locator.Owner, Is.EqualTo("EbenZhang"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(183));

            locator = PullRequestLocator.FromUrl(@"https://github.com/EbenZhang1/EZPlayer1/pull/184");
            Assert.That(locator.Owner, Is.EqualTo("EbenZhang1"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer1"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(184));
        }
        public void CanProcessProtocolInACaseInsensitiveManner()
        {
            var locator = PullRequestLocator.FromUrl(@"Https://github.com/EbenZhang/EZPlayer/pull/183");

            Assert.That(locator.Owner, Is.EqualTo("EbenZhang"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(183));

            locator = PullRequestLocator.FromUrl(@"HtTps://github.com/EbenZhang1/EZPlayer1/pull/184");
            Assert.That(locator.Owner, Is.EqualTo("EbenZhang1"));
            Assert.That(locator.Repository, Is.EqualTo("EZPlayer1"));
            Assert.That(locator.PullRequestNumber, Is.EqualTo(184));
        }
Beispiel #6
0
        public async void ShouldInsertMostRecentRepoToTheBegining()
        {
            var container = new RepoHistoryContainer();

            for (var i = 1; i <= 4; ++i)
            {
                container.Urls.Add("https://github.com/gitext/gitextensions/pull/" + i);
            }
            var repoHistory = new RecentRepo();

            repoHistory.From(container);

            const string newPrUrl  = "https://github.com/ebenzhang/ezplayer/pull/21000";
            var          newPrInfo = PullRequestLocator.FromUrl(newPrUrl);
            var          persist   = Substitute.For <IRepoHistoryPersist>();
            await repoHistory.Save(newPrInfo, persist);

            repoHistory.PullRequests.First().ShouldBe(newPrInfo);
            repoHistory.Owners.First().ShouldBe("ebenzhang");
            repoHistory.Repositories.First().ShouldBe("ezplayer");
        }