Пример #1
0
        private static void Main()
        {
            using (
                var client = new HttpClient {BaseAddress = new Uri(ConfigurationManager.AppSettings["VSOnlineBaseUrl"])}
                )
            {
                var history = new Historian(
                    new WorkItemRepository(new TfsConnection(ConfigurationManager.AppSettings["username"],
                        ConfigurationManager.AppSettings["password"], client)));

                var burnup = history.GetBurnUpDataSince(new DateTime(2014, 7, 7, 23, 59, 59), @"BPS.Scrum\Dev -SEP Project");
                using (var writer = new StreamWriter(@".\completed" + DateTime.Now.ToString("yyyymmmmdd") + ".xls"))
                {
                    var csvWriter = new CsvWriter(writer, new CsvConfiguration { Delimiter = "\t" });

                    csvWriter.WriteRecords(burnup.First(s => s.Title == "Completed").Data);
                }

                using (var writer = new StreamWriter(@".\requested" + DateTime.Now.ToString("yyyymmmmdd") + ".xls"))
                {
                    var csvWriter = new CsvWriter(writer, new CsvConfiguration { Delimiter = "\t" });

                    csvWriter.WriteRecords(burnup.First(s => s.Title == "Requested").Data);
                }
            }
        }
Пример #2
0
        private static void Main()
        {
            using (
                var client = new HttpClient {
                BaseAddress = new Uri(ConfigurationManager.AppSettings["VSOnlineBaseUrl"])
            }
                )
            {
                var history = new Historian(
                    new WorkItemRepository(new TfsConnection(ConfigurationManager.AppSettings["username"],
                                                             ConfigurationManager.AppSettings["password"], client)));


                var burnup = history.GetBurnUpDataSince(new DateTime(2014, 7, 7, 23, 59, 59), @"BPS.Scrum\Dev -SEP Project");
                using (var writer = new StreamWriter(@".\completed" + DateTime.Now.ToString("yyyymmmmdd") + ".xls"))
                {
                    var csvWriter = new CsvWriter(writer, new CsvConfiguration {
                        Delimiter = "\t"
                    });

                    csvWriter.WriteRecords(burnup.First(s => s.Title == "Completed").Data);
                }

                using (var writer = new StreamWriter(@".\requested" + DateTime.Now.ToString("yyyymmmmdd") + ".xls"))
                {
                    var csvWriter = new CsvWriter(writer, new CsvConfiguration {
                        Delimiter = "\t"
                    });

                    csvWriter.WriteRecords(burnup.First(s => s.Title == "Requested").Data);
                }
            }
        }
        public void ShouldHaveZerosForDatesThatDoNotHaveCompletedPRBI()
        {
            using (
                var client = new HttpClient {
                BaseAddress = new Uri(ConfigurationManager.AppSettings["VSOnlineBaseUrl"])
            }
                )
            {
                var history = new Historian(
                    new WorkItemRepository(new TfsConnection(ConfigurationManager.AppSettings["username"],
                                                             ConfigurationManager.AppSettings["password"], client)));
                var firstDate = new DateTime(2014, 7, 7, 23, 59, 59);
                var burnup    = history.GetBurnUpDataSince(firstDate, @"BPS.Scrum\Dev -SEP Project");

                Assert.AreEqual(firstDate.Date.Date, burnup.First(s => s.Title == "Completed").Data.First().Date.Date);
                Assert.AreEqual(0, (int)burnup.First(s => s.Title == "Completed").Data.First().Value);
            }
        }
        public void ShoudldGetCBurnupAsOfACertianDateIntegrationTest()
        {
            using (
                var client = new HttpClient {
                BaseAddress = new Uri(ConfigurationManager.AppSettings["VSOnlineBaseUrl"])
            }
                )
            {
                var history = new Historian(
                    new WorkItemRepository(new TfsConnection(ConfigurationManager.AppSettings["username"],
                                                             ConfigurationManager.AppSettings["password"], client)));

                var burnup = history.GetBurnUpDataSince(new DateTime(2014, 7, 30, 23, 59, 59), @"BPS.Scrum\Dev -SEP Project");

                Assert.AreEqual(213, (int)burnup.First(s => s.Title == "Requested").Data.First().Value);
                Assert.AreEqual(38, (int)burnup.First(s => s.Title == "Completed").Data.First().Value);
            }
        }
        public void ShoudldGetCommittedAndClosedWorkItemsAsOfACertianDate()
        {
            QueryResults allResults = GetTestQueryResult();

            mockRepo.Setup(s => s.GetPrdouctBacklogItemsAsOf(It.IsAny <string>(), It.IsAny <DateTime>(), It.Is <string>(a => a == null), It.Is <string>(a => a == null))).ReturnsAsync(allResults);
            QueryResults closedResults = GetDoneQueryResult();

            mockRepo.Setup(s => s.GetPrdouctBacklogItemsAsOf(It.IsAny <string>(), It.IsAny <DateTime>(), It.Is <string>(a => a == "Done"), It.Is <string>(a => a == null))).ReturnsAsync(closedResults);

            var workitems = GetTestWorkItems();

            mockRepo.Setup(s => s.GetWorkItemsAsOf(It.IsAny <DateTime>(), It.Is <int[]>(a => a.Length == 2))).ReturnsAsync(workitems);
            mockRepo.Setup(s => s.GetWorkItemsAsOf(It.IsAny <DateTime>(), It.Is <int[]>(a => a.Length == 1))).ReturnsAsync(workitems.Where(s => s.State == "Done"));

            var history = new Historian(mockRepo.Object);

            var burnUpData = history.GetBurnUpDataSince(new DateTime(2014, 7, 30), "Test area");

            Assert.AreEqual(11, burnUpData.First(s => s.Title == "Requested").Data.First().Value);
            Assert.AreEqual(3, burnUpData.First(s => s.Title == "Completed").Data.First().Value);
        }