protected void Init()
        {
            var pullRequestsResource = SampleRepositories.TestRepository.RepositoryResource.PullRequestsResource();

            // there is no change that a pull request with the max value of int32 exist one day
            NotExistingPullRequest = pullRequestsResource.PullRequestResource(int.MaxValue);
        }
Ejemplo n.º 2
0
        protected void Init()
        {
            // pull request number 2 on MercurialRepository is public and declined
            // so we could expect that it will be always accessible and won't change
            // which is what we need to have reproducible tests
            ExistingPullRequest = SampleRepositories.MercurialRepository.PullRequestsResource().PullRequestResource(2);

            // there is no change that a pull request with the max value of int32 exist one day
            NotExistingPullRequest = SampleRepositories.MercurialRepository.PullRequestsResource().PullRequestResource(int.MaxValue);
        }
Ejemplo n.º 3
0
        public async Task GetPullRequests()
        {
            var pullRequestResource = new PullRequestResource
            {
                Count = 1,
                value = new[]
                {
                    new PullRequest
                    {
                        AzureRepository = new AzureRepository
                        {
                            id      = "3411ebc1-d5aa-464f-9615-0b527bc66719",
                            name    = "2016_10_31",
                            url     = "https://dev.azure.com/fabrikam/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719",
                            project = new Project
                            {
                                id          = "a7573007-bbb3-4341-b726-0c4148a07853",
                                name        = "2016_10_31",
                                description = "test project created on Halloween 2016",
                                url         = "https://dev.azure.com/fabrikam/_apis/projects/a7573007-bbb3-4341-b726-0c4148a07853",
                                state       = "wellFormed",
                                revision    = 7
                            },
                            remoteUrl = "https://dev.azure.com/fabrikam/_git/2016_10_31"
                        },
                        PullRequestId      = 22,
                        CodeReviewId       = 22,
                        Status             = "active",
                        CreationDate       = new DateTime(2016, 11, 01, 16, 30, 31),
                        Title              = "A new feature",
                        Description        = "Adding a new feature",
                        SourceRefName      = "refs/heads/npaulk/my_work",
                        TargetRefName      = "refs/heads/new_feature",
                        MergeStatus        = "queued",
                        MergeId            = "f5fc8381-3fb2-49fe-8a0d-27dcc2d6ef82",
                        Url                = "https: //dev.azure.com/fabrikam/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/commits/b60280bc6e62e2f880f1b63c1e24987664d3bda3",
                        SupportsIterations = true,
                    }
                }
            };

            var restClient        = GetFakeClient(pullRequestResource);
            var foundPullRequests = await restClient.GetPullRequests("ProjectName", "RepoId", "head", "base");

            Assert.IsNotNull(foundPullRequests);
            Assert.AreEqual(1, foundPullRequests.Count());
        }