Example #1
0
        public async void WhenRetrieveDiffs_ShouldAdjustRepoPositionInHistory_SoItWillBeTheDefaultRepo()
        {
            var container = new RepoHistoryContainer()
            {
                Owners = new List <string> {
                    "owner1", "owner2"
                },
                Repositories = new List <string> {
                    "repo1", "repo2"
                },
                Urls = new List <string> {
                    "https://github.com/owner/repo1/pull/122", "https://github.com/owner/repo2/pull/121"
                },
            };

            var persist = Substitute.For <IRepoHistoryPersist>();

            var repoHistory = new RecentRepo();

            repoHistory.From(container);
            var prInfo = new PullRequestLocator();

            prInfo.UpdateWith(container.Urls.First());
            await repoHistory.Save(prInfo, persist);

            persist.Received(1).Save(Arg.Is <RepoHistoryContainer>(x => x.Urls.First() == prInfo.ToUrl())).IgnoreAsyncWarning();
        }
Example #2
0
 private void CoercePullRequestUrlAndLocator()
 {
     _prePullRequestLocator = PullRequestLocator;
     if (IsUrlMode)
     {
         try
         {
             PullRequestLocator.UpdateWith(PullRequestUrl);
         }
         catch (Exception ex)
         {
             throw new UriFormatException(ex.ToString());
         }
     }
     else
     {
         PullRequestUrl = PullRequestLocator.ToUrl();
     }
 }