public void Forecast_8_issues() { const int N_RESOURCES = 3; var issues = IssueRepository.Import().ToArray(); IEnumerable <Issue> Filter_issues(params string[] tags) => issues.Where(i => tags.All(t => i.Tags.Contains(t))); int[] Get_cycle_times_in_days(IEnumerable <Issue> issues) => issues.Select(x => x.CycleTime.Days).ToArray(); var frontend_feature_cts = Get_cycle_times_in_days(Filter_issues("frontend", "feature")); var backend_bug_cts = Get_cycle_times_in_days(Filter_issues("backend", "bug")); var backend_feature_cts = Get_cycle_times_in_days(Filter_issues("backend", "feature")); _testOutputHelper.WriteLine($"Events found: {frontend_feature_cts.Length}, {backend_bug_cts.Length}, {backend_feature_cts.Length}"); var sut = new SoftwareDeliverySimulation(); var simulationresult = sut.SimulateIssueDeliveryByResources(N_RESOURCES, frontend_feature_cts, frontend_feature_cts, frontend_feature_cts, backend_bug_cts, backend_feature_cts, backend_feature_cts, backend_feature_cts, backend_feature_cts ); var distribution = Statistics.Distribution(simulationresult); var deDE = new CultureInfo("de-DE"); foreach (var x in distribution.OrderBy(o => o.value)) { _testOutputHelper.WriteLine($"{x.value}\t{x.frequency}\t{x.probability.ToString("0.000", deDE)}\t{x.percentile.ToString("0.0", deDE)}"); } }
public void Single_issue_single_resource() { var historicalCTs = new[] { 1, 2, 3 }; var randomNumbers = new Queue <int>(new[] { 2, 1, 0 }); var sut = new SoftwareDeliverySimulation(3, maxNumber => randomNumbers.Dequeue()); var result = sut.SimulateIssueDeliveryByResources(historicalCTs); Assert.Empty(randomNumbers); Assert.Equal(new[] { 3, 2, 1 }, result); }
public void Two_issues_two_resources() { var historicalCTsA = new[] { 1, 2, 3 }; var historicalCTsB = new[] { 10, 20, 30 }; var randomNumbers = new Queue <int>(new[] { 2, 1, 0, 2, 1, 0 }); var sut = new SoftwareDeliverySimulation(3, maxNumber => randomNumbers.Dequeue()); var result = sut.SimulateIssueDeliveryByResources(2, historicalCTsA, historicalCTsB); Assert.Empty(randomNumbers); Assert.Equal(new[] { 20, 30, 10 }, result); }