Exemplo n.º 1
0
        public void SetsPunchPointsAsReadOnlyDictionary()
        {
            IList<int> point1 = new[] { 1, 0, 3 };
            IList<int> point2 = new[] { 1, 1, 4 };
            IList<int> point3 = new[] { 1, 2, 0 };
            IEnumerable<IList<int>> points = new List<IList<int>> { point1, point2, point3 };

            var punchCard = new PunchCard(points);

            AssertEx.IsReadOnlyCollection<PunchCardPoint>(punchCard.PunchPoints);
        }
Exemplo n.º 2
0
        public void CanQueryCommitsForDayAndHour()
        {
            IList<int> point1 = new[] { 1, 0, 3 };
            IList<int> point2 = new[] { 1, 1, 4 };
            IList<int> point3 = new[] { 1, 2, 0 };
            IEnumerable<IList<int>> points = new List<IList<int>> { point1, point2, point3 };

            var punchCard = new PunchCard(points);

            var commitsAtMondayAt12Am = punchCard.GetCommitCountFor(DayOfWeek.Monday, 0);
            var commitsAtMondayAt1Am = punchCard.GetCommitCountFor(DayOfWeek.Monday, 1);
            var commitsAtMondayAt2Am = punchCard.GetCommitCountFor(DayOfWeek.Monday, 2);
            var commitsAtTuesdayAt2Am = punchCard.GetCommitCountFor(DayOfWeek.Tuesday, 2);

            Assert.Equal(3, commitsAtMondayAt12Am);
            Assert.Equal(4, commitsAtMondayAt1Am);
            Assert.Equal(0, commitsAtMondayAt2Am);
            Assert.Equal(0, commitsAtTuesdayAt2Am);
        }
Exemplo n.º 3
0
 public void DoesNotThrowExceptionWhenPunchPointsHaveCorrectFormat()
 {
     IList<int> point1 = new[] { 1, 2, 3 };
     IEnumerable<IList<int>> points = new List<IList<int>> { point1 };
     var punchcard = new PunchCard(points);
 }
Exemplo n.º 4
0
        public Repo(Octokit.Repository repo, IEnumerable <Contributor> contributors, Octokit.CommitActivity commitActivity,
                    Octokit.CodeFrequency codeFrequency, Octokit.Participation participation, Octokit.PunchCard punchCard)
        {
            this.CloneUrl        = repo.CloneUrl;
            this.CreatedAt       = repo.CreatedAt;
            this.Description     = repo.Description;
            this.Fork            = repo.Fork;
            this.FullName        = repo.FullName;
            this.GitUrl          = repo.GitUrl;
            this.HasDownloads    = repo.HasDownloads;
            this.HasIssues       = repo.HasIssues;
            this.HasWiki         = repo.HasWiki;
            this.Homepage        = repo.Homepage;
            this.HtmlUrl         = repo.HtmlUrl;
            this.Id              = repo.Id;
            this.Language        = repo.Language;
            this.MasterBranch    = repo.MasterBranch;
            this.MirrorUrl       = repo.MirrorUrl;
            this.Name            = repo.Name;
            this.OpenIssuesCount = repo.OpenIssuesCount;
            this.Organization    = repo.Organization;
            this.Owner           = repo.Owner;
            this.Parent          = repo.Parent;
            this.Private         = repo.Private;
            this.PushedAt        = repo.PushedAt;
            this.Source          = repo.Source;
            this.SshUrl          = repo.SshUrl;
            this.SvnUrl          = repo.SvnUrl;
            this.UpdatedAt       = repo.UpdatedAt;
            this.Url             = repo.Url;

            this.ForksCount    = repo.ForksCount;
            this.WatchersCount = repo.WatchersCount;

            this.contributors = new List <Contributors>();
            foreach (var contributor in contributors)
            {
                this.contributors.Add(new Contributors(contributor.Author, contributor.Total, contributor.Weeks));
            }
            this.commitActivity = new List <WeeklyCommitActivity>();
            foreach (var weeklyAct in commitActivity.Activity)
            {
                this.commitActivity.Add(new WeeklyCommitActivity(weeklyAct));
            }
            this.codeFrequency = new List <CodeFrequency>();
            foreach (var AAndDByWeek in codeFrequency.AdditionsAndDeletionsByWeek)
            {
                this.codeFrequency.Add(new CodeFrequency(AAndDByWeek.Timestamp, AAndDByWeek.Additions, AAndDByWeek.Deletions));
            }
            this.participation = new List <Participation>();
            var AllEnum = participation.All.GetEnumerator();
            var OwnEnum = participation.Owner.GetEnumerator();

            while (AllEnum.MoveNext() && OwnEnum.MoveNext())
            {
                this.participation.Add(new Participation(AllEnum.Current, OwnEnum.Current));
            }
            this.punchCard = new List <PunchCardPoint>();
            foreach (var pcp in punchCard.PunchPoints)
            {
                this.punchCard.Add(new PunchCardPoint(pcp.DayOfWeek, pcp.HourOfTheDay, pcp.CommitCount));
            }
        }