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); }
public void WorkDays_WhenWeekendsNotSet_ShouldReturnAllDays() { // arrange var stats = new List <TeamStats> { new TeamStats { DateOf = DateTime.Parse("2018-07-22") }, new TeamStats { DateOf = DateTime.Parse("2018-07-23") }, new TeamStats { DateOf = DateTime.Parse("2018-07-24") }, new TeamStats { DateOf = DateTime.Parse("2018-07-25") }, new TeamStats { DateOf = DateTime.Parse("2018-07-26") }, new TeamStats { DateOf = DateTime.Parse("2018-07-27") }, new TeamStats { DateOf = DateTime.Parse("2018-07-28") } }; var sut = new TeamStatsCollection(stats, null); // act var actual = sut.GetWorkDayStats(); // assert var expected = new List <TeamStats> { new TeamStats { DateOf = DateTime.Parse("2018-07-22") }, new TeamStats { DateOf = DateTime.Parse("2018-07-23") }, new TeamStats { DateOf = DateTime.Parse("2018-07-24") }, new TeamStats { DateOf = DateTime.Parse("2018-07-25") }, new TeamStats { DateOf = DateTime.Parse("2018-07-26") }, new TeamStats { DateOf = DateTime.Parse("2018-07-27") }, new TeamStats { DateOf = DateTime.Parse("2018-07-28") } }; actual.Should().BeEquivalentTo(expected); }
public void WorkDays_WhenWeekendsSet_ShouldReturnDaysWithoutWeekends() { // arrange var stats = new List <TeamStats> { new TeamStats { DateOf = DateTime.Parse("2018-07-22") }, new TeamStats { DateOf = DateTime.Parse("2018-07-23") }, new TeamStats { DateOf = DateTime.Parse("2018-07-24") }, new TeamStats { DateOf = DateTime.Parse("2018-07-25") }, new TeamStats { DateOf = DateTime.Parse("2018-07-26") }, new TeamStats { DateOf = DateTime.Parse("2018-07-27") }, new TeamStats { DateOf = DateTime.Parse("2018-07-28") }, }; var weekends = new List <DayOfWeek> { DayOfWeek.Saturday, DayOfWeek.Sunday }; var sut = new TeamStatsCollection(stats, weekends); // act var actual = sut.GetWorkDayStats(); // assert var expected = new List <TeamStats> { new TeamStats { DateOf = DateTime.Parse("2018-07-23") }, new TeamStats { DateOf = DateTime.Parse("2018-07-24") }, new TeamStats { DateOf = DateTime.Parse("2018-07-25") }, new TeamStats { DateOf = DateTime.Parse("2018-07-26") }, new TeamStats { DateOf = DateTime.Parse("2018-07-27") } }; actual.Should().BeEquivalentTo(expected); }
public void RenderDashboard(IList <DeveloperStats> developerStats, TeamStatsCollection teamStats, ReportingPeriod reportingPeriod) { PrintApplicationHeader(reportingPeriod.Start, reportingPeriod.End); PrintDeveloperStatsTableHeader(); PrintDeveloperStatsTable(developerStats); PrintDeveloperAverages(developerStats, reportingPeriod); PrintTeamStatsTableHeader(); PrintTeamStatsTable(teamStats); }
private void PrintTeamStatsTable(TeamStatsCollection teamStats) { var orderedStats = teamStats .GetWorkDayStats() .OrderBy(x => x.DateOf); foreach (var stat in orderedStats) { Console.WriteLine(stat); } PrintDashedLine(); }