コード例 #1
0
        public void GetChangedReferences_WithMultipleReferencesChanged()
        {
            var path           = ReadTxtFromFakeFile("TwoChangedReferences.txt");
            var resultExpected = new string[2] {
                "System.Data", "System.Generics"
            };

            var result = _csprojFileServices.GetChangedReferences(path);

            Assert.Collection(result, x => Assert.Equal(resultExpected[0], x),
                              x => Assert.Equal(resultExpected[1], x));
        }
        public async Task <InfoFromPullRequestDto> Get(long repositoryId, int pullRequest)
        {
            var changedCsprojFiles = new List <string>();

            var pullRequestFiles = await _githubConnection.GetFilesFromPullRequest(repositoryId, pullRequest);

            pullRequestFiles
            .Where(x => x.FileName.IsCsProjFile())
            .ToList()
            .ForEach(x => { changedCsprojFiles.AddRange(_csprojFileServices.GetChangedReferences(x.Path)); });

            return(new InfoFromPullRequestDto
            {
                ChangedFiles = pullRequestFiles.Count(),
                ChangedCsprojFiles = pullRequestFiles.Count(x => x.FileName.IsCsProjFile()),
                ChangedReferences = changedCsprojFiles
            });
        }