Ejemplo n.º 1
0
            public void WhenUsingAlias_ShouldReturnSingleDeveloperWithTwoEmails()
            {
                // arrange
                var repoPath = TestRepoPath("git-test-operations");
                var aliasMap = new List <Alias>
                {
                    new Alias {
                        Name = "T-rav", Emails = new List <string> {
                            "*****@*****.**", "*****@*****.**"
                        }
                    }
                };

                using (var aliasFileContext = WriteAliasMapping(aliasMap))
                {
                    var sut = new SourceControlAnalysisBuilder()
                              .WithPath(repoPath)
                              .WithEntireHistory()
                              .WithBranch("origin/my-branch")
                              .WithAliasMapping(aliasFileContext.Path)
                              .Build();
                    // act
                    var actual = sut.List_Authors();
                    // assert
                    var expected = 1;
                    actual.Count().Should().Be(expected);
                }
            }
Ejemplo n.º 2
0
            public void WhenDeveloperBranch_ShouldReturnAllActiveDevelopers()
            {
                // arrange
                var repoPath = TestRepoPath("git-test-operations");
                var sut      = new SourceControlAnalysisBuilder()
                               .WithPath(repoPath)
                               .WithBranch("origin/my-branch")
                               .WithRange(DateTime.Parse("2018-7-16"), DateTime.Parse("2018-07-17"))
                               .Build();
                // act
                var actual = sut.List_Authors();
                // assert
                var expected = new List <Author>
                {
                    new Author {
                        Name = "T-rav", Emails = new List <string> {
                            "*****@*****.**"
                        }
                    },
                    new Author {
                        Name = "Travis", Emails = new List <string> {
                            "*****@*****.**"
                        }
                    }
                };

                actual.Should().BeEquivalentTo(expected);
            }
Ejemplo n.º 3
0
            public void WhenNullAliases_ShouldReturnTwoDevelopers()
            {
                // arrange
                var repoPath = TestRepoPath("git-test-operations");

                var sut = new SourceControlAnalysisBuilder()
                          .WithPath(repoPath)
                          .WithEntireHistory()
                          .WithBranch("origin/my-branch")
                          .Build();
                // act
                var actual = sut.List_Authors();
                // assert
                var expected = 2;

                actual.Count().Should().Be(expected);
            }
Ejemplo n.º 4
0
            public void WhenEmpyAliases_ShouldReturnTwoDevelopers()
            {
                // arrange
                var repoPath = TestRepoPath("git-test-operations");
                var aliasMap = new List <Alias>();

                using (var aliasFileContext = WriteAliasMapping(aliasMap))
                {
                    var sut = new SourceControlAnalysisBuilder()
                              .WithPath(repoPath)
                              .WithEntireHistory()
                              .WithBranch("origin/my-branch")
                              .WithAliasMapping(aliasFileContext.Path)
                              .Build();
                    // act
                    var actual = sut.List_Authors();
                    // assert
                    var expected = 2;
                    actual.Count().Should().Be(expected);
                }
            }
Ejemplo n.º 5
0
        private static int DisplayRangedHistory(RangedHistory opts)
        {
            using (var repo = new SourceControlAnalysisBuilder()
                              .WithPath(opts.Path)
                              .WithRange(opts.StartDate, opts.EndDate)
                              .WithIgnorePatterns(opts.IgnorePatterns)
                              .WithBranch(opts.Branch)
                              .WithWeekends(opts.WeekendDays)
                              .WithWorkingDaysPerWeek(opts.WorkingDaysPerWeek)
                              .WithWorkingWeekHours(opts.WorkingHoursPerWeek)
                              .WithIgnoreComments(opts.IgnoreComments)
                              .Build())
            {
                var dashboard = new CodeStatsDashboard();
                var authors   = repo.List_Authors();
                var stats     = repo.Build_Individual_Developer_Stats(authors);
                var teamStats = repo.Build_Team_Stats();
                dashboard.RenderDashboard(stats, teamStats, repo.ReportingRange);

                return(1);
            }
        }
Ejemplo n.º 6
0
        private static int DisplayFullHistory(FullHistory opts)
        {
            using (var repo = new SourceControlAnalysisBuilder()
                              .WithPath(opts.Path)
                              .WithEntireHistory()
                              .WithIgnorePatterns(opts.IgnorePatterns)
                              .WithBranch(opts.Branch)
                              .WithWeekends(opts.WeekendDays)
                              .WithWorkingDaysPerWeek(opts.WorkingDaysPerWeek)
                              .WithWorkingWeekHours(opts.WorkingHoursPerWeek)
                              .WithIgnoreComments(opts.IgnoreComments)
                              .Build())
            {
                // todo : make configurable
                //var aliasMap = new List<Alias>
                //{
                //    new Alias{
                //        Name = "T-rav",
                //        Emails = new List<string>{
                //            "*****@*****.**",
                //            "*****@*****.**",
                //            "*****@*****.**"}
                //    }
                //};

                // todo : wip, first attempt to make aliases confiurable
                //var aliasRepository = new AliasRepository(opts.AliasFile);
                //var aliasMap = aliasRepository.Load();

                var dashboard = new CodeStatsDashboard();
                var authors   = repo.List_Authors();
                var stats     = repo.Build_Individual_Developer_Stats(authors);
                var teamStats = repo.Build_Team_Stats();
                dashboard.RenderDashboard(stats, teamStats, repo.ReportingRange);
            }

            return(1);
        }