示例#1
0
        public void Groups_issues_in_single_day()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            builder.ForwardTime(TimeSpan.FromDays(0.5));
            builder.UpdateIssue(2, DevState);
            builder.ForwardTime(TimeSpan.FromDays(0.5));
            builder.UpdateIssue(3, DevState);
            builder.ForwardTime(TimeSpan.FromDays(0.5));
            builder.UpdateIssue(4, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState });

            Assert.Equal(2, cfa.Changes.Length);

            var firstChange = cfa.Changes[0];

            Assert.Equal(new DateTime(2010, 07, 03), firstChange.Date);
            Assert.Equal(new int[] { 2 }, firstChange.StateCounts);

            var secondChange = cfa.Changes[1];

            Assert.Equal(new DateTime(2010, 07, 04), secondChange.Date);
            Assert.Equal(new int[] { 4 }, secondChange.StateCounts);
        }
示例#2
0
        public void Multiple_issues_in_same_day()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            builder.UpdateIssue(2, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState });

            var firstChange = Assert.Single(cfa.Changes);

            Assert.Equal(new DateTime(2010, 07, 03), firstChange.Date);
            Assert.Equal(new int[] { 2 }, firstChange.StateCounts);
        }
示例#3
0
        public void From_date_shows_only_changes_from_given_date(int offsetDays)
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            builder.ForwardTime(TimeSpan.FromDays(offsetDays));
            builder.UpdateIssue(2, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState, DoneState }, new DateTime(2010, 07, 05));

            var change = Assert.Single(cfa.Changes);

            Assert.Equal(new DateTime(2010, 07, 03 + offsetDays), change.Date);
            Assert.Equal(new int[] { 0, 0, 2 }, change.StateCounts);
        }
示例#4
0
        public void Done_issues_before_from_date_are_ignored(int doneStatesBefore)
        {
            var builder = new FlatIssueBuilder();

            for (int i = 0; i < doneStatesBefore; i++)
            {
                builder.UpdateIssue(i, DoneState);
            }
            builder.ForwardTime(TimeSpan.FromDays(3));
            builder.UpdateIssue(100, DoneState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState, DoneState }, new DateTime(2010, 07, 05));

            var change = Assert.Single(cfa.Changes);

            Assert.Equal(new DateTime(2010, 07, 06), change.Date);
            Assert.Equal(new int[] { 1, 0, 0 }, change.StateCounts);
        }
示例#5
0
        public void Issue_that_skips_state_while_other_issues_are_in_progress()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(4, DevState);
            builder.UpdateIssue(5, DevState);
            builder.UpdateIssue(6, DevState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(4, QaState);
            builder.UpdateIssue(5, QaState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(4, DoneState);

            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(1, QaState);

            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState, DoneState });

            Assert.Equal(4, cfa.Changes.Length);

            var allStates = cfa.Changes[2];

            Assert.Equal(new DateTime(2010, 07, 05), allStates.Date);
            Assert.Equal(new int[] { 1, 1, 1 }, allStates.StateCounts);

            var skippedDevChange = cfa.Changes[3];

            Assert.Equal(new DateTime(2010, 07, 06), skippedDevChange.Date);
            Assert.Equal(new int[] { 1, 2, 1 }, skippedDevChange.StateCounts);
        }
示例#6
0
        public void From_date_filter_results_in_empty_changes()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState, DoneState }, new DateTime(2010, 07, 06));

            Assert.Empty(cfa.Changes);
        }
示例#7
0
        public void Ignores_unspecified_state()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { QaState });

            Assert.Empty(cfa.Changes);
        }
示例#8
0
        public void Issue_that_skips_state()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, QaState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState, DoneState });

            var change = Assert.Single(cfa.Changes);

            Assert.Equal(new DateTime(2010, 07, 03), change.Date);
            Assert.Equal(new int[] { 0, 1, 0 }, change.StateCounts);
        }
示例#9
0
        public void Changes_are_ordered_by_date()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(2, DevState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(1, QaState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(2, QaState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(3, DevState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState, QaState });

            Assert.Equal(5, cfa.Changes.Length);

            var dates = cfa.Changes.Select(x => x.Date).ToArray();

            Assert.Equal(dates.OrderBy(x => x), dates);
        }
示例#10
0
        public void Multiple_started_issues()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            builder.ForwardTime(TimeSpan.FromDays(1));
            builder.UpdateIssue(2, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState });

            Assert.Equal(new[] { DevState }, cfa.States);

            Assert.Equal(2, cfa.Changes.Length);

            var firstChange = cfa.Changes[0];

            Assert.Equal(new DateTime(2010, 07, 03), firstChange.Date);
            Assert.Equal(new int[] { 1 }, firstChange.StateCounts);

            var secondChange = cfa.Changes[1];

            Assert.Equal(new DateTime(2010, 07, 04), secondChange.Date);
            Assert.Equal(new int[] { 2 }, secondChange.StateCounts);
        }
示例#11
0
        public void Single_started_issue()
        {
            var builder = new FlatIssueBuilder();

            builder.UpdateIssue(1, DevState);
            CumulativeFlowAnalysis cfa = new CumulativeFlowAnalysis(builder.BuildIssues(), new[] { DevState });

            Assert.Equal(new[] { DevState }, cfa.States);

            var change = Assert.Single(cfa.Changes);

            Assert.Equal(new DateTime(2010, 07, 03), change.Date);
            Assert.Equal(1, change.StateCounts[0]);
        }