Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }