Exemplo n.º 1
0
            public void WhenRangeOneDay_ShouldReturnStats()
            {
                // arrange
                var repoPath = TestRepoPath("git-test-operations");

                var sut = new SourceControlAnalysisBuilder()
                          .WithPath(repoPath)
                          .WithRange(DateTime.Parse("2018-07-16"), DateTime.Parse("2018-07-16"))
                          .WithWorkingDaysPerWeek(4)
                          .WithWorkingWeekHours(32)
                          .Build();
                // act
                var actual = sut.Build_Team_Stats();
                // assert
                var stats = new List <TeamStats>
                {
                    new TeamStats
                    {
                        DateOf           = DateTime.Parse("2018-07-16"),
                        ActiveDevelopers = 1,
                        TotalCommits     = 3
                    }
                };
                var expected = new TeamStatsCollection(stats, new List <DayOfWeek>());

                actual.Should().BeEquivalentTo(expected);
            }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
        }