public async Task AzLeadTimeControllerAPILiveIntegrationTest()
        {
            //Arrange
            bool   getSampleData    = false;
            string patToken         = "";//Configuration["AppSettings:AzureDevOpsPatToken"];
            string organization     = "samsmithnz";
            string project          = "SamLearnsAzure";
            string repositoryId     = "SamLearnsAzure";
            string branch           = "refs/heads/master";
            string buildName        = "SamLearnsAzure.CI";
            int    numberOfDays     = 30;
            int    maxNumberOfItems = 20;
            bool   useCache         = true;
            LeadTimeForChangesController controller = new LeadTimeForChangesController(Configuration);

            //Act
            LeadTimeForChangesModel model = await controller.GetAzureDevOpsLeadTimeForChanges(getSampleData, patToken, organization, project, repositoryId, branch, buildName, numberOfDays, maxNumberOfItems, useCache);

            //Assert
            Assert.IsTrue(model != null);
            if (model.RateLimitHit == false)
            {
                Assert.AreEqual(project, model.ProjectName);
                Assert.IsTrue(model.PullRequests.Count >= 0);
                if (model.PullRequests.Count > 0)
                {
                    Assert.IsTrue(string.IsNullOrEmpty(model.PullRequests[0].PullRequestId) == false);
                    Assert.IsTrue(string.IsNullOrEmpty(model.PullRequests[0].Branch) == false);
                    Assert.IsTrue(model.PullRequests[0].BuildCount >= 0);
                    Assert.IsTrue(model.PullRequests[0].Commits.Count >= 0);
                    if (model.PullRequests[0].Commits.Count > 0)
                    {
                        Assert.IsTrue(string.IsNullOrEmpty(model.PullRequests[0].Commits[0].commitId) == false);
                        Assert.IsTrue(model.PullRequests[0].Commits[0].date >= DateTime.MinValue);
                        Assert.IsTrue(string.IsNullOrEmpty(model.PullRequests[0].Commits[0].name) == false);
                    }
                    Assert.IsTrue(Math.Round(model.PullRequests[0].Duration.TotalMinutes, 0) >= 0);
                    Assert.IsTrue(model.PullRequests[0].DurationPercent >= 0);
                    Assert.IsTrue(model.PullRequests[0].StartDateTime >= DateTime.MinValue);
                    Assert.IsTrue(model.PullRequests[0].EndDateTime >= DateTime.MinValue);
                }
                Assert.IsTrue(model.AverageBuildHours >= 0);
                Assert.IsTrue(model.AveragePullRequestHours >= 0);
                Assert.IsTrue(model.LeadTimeForChangesMetric >= 0);
                Assert.IsTrue(string.IsNullOrEmpty(model.LeadTimeForChangesMetricDescription) == false);
                Assert.AreEqual(numberOfDays, model.NumberOfDays);
                Assert.IsTrue(model.MaxNumberOfItems > 0);
                Assert.IsTrue(model.TotalItems > 0);
            }
        }
        public async Task AzLeadTimeControllerIntegrationTest()
        {
            //Arrange
            bool   getSampleData    = true;
            string patToken         = Configuration["AppSettings:AzureDevOpsPatToken"];
            string organization     = "samsmithnz";
            string project          = "SamLearnsAzure";
            string repositoryId     = "SamLearnsAzure";
            string branch           = "refs/heads/master";
            string buildName        = "SamLearnsAzure.CI";
            int    numberOfDays     = 7;
            int    maxNumberOfItems = 20;
            bool   useCache         = true;
            LeadTimeForChangesController controller = new LeadTimeForChangesController(Configuration);

            //Act
            LeadTimeForChangesModel model = await controller.GetAzureDevOpsLeadTimeForChanges(getSampleData, patToken, organization, project, repositoryId, branch, buildName, numberOfDays, maxNumberOfItems, useCache);

            //Assert
            Assert.IsTrue(model != null);
            Assert.AreEqual(project, model.ProjectName);
            Assert.IsTrue(model.PullRequests.Count > 0);
            Assert.AreEqual("123", model.PullRequests[0].PullRequestId);
            Assert.AreEqual("branch1", model.PullRequests[0].Branch);
            Assert.AreEqual(1, model.PullRequests[0].BuildCount);
            Assert.IsTrue(model.PullRequests[0].Commits.Count > 0);
            Assert.AreEqual("abc", model.PullRequests[0].Commits[0].commitId);
            Assert.IsTrue(model.PullRequests[0].Commits[0].date >= DateTime.MinValue);
            Assert.AreEqual("name1", model.PullRequests[0].Commits[0].name);
            Assert.AreEqual(60, Math.Round(model.PullRequests[0].Duration.TotalMinutes, 0));
            Assert.AreEqual(33f, model.PullRequests[0].DurationPercent);
            Assert.IsTrue(model.PullRequests[0].StartDateTime >= DateTime.MinValue);
            Assert.IsTrue(model.PullRequests[0].EndDateTime >= DateTime.MinValue);
            Assert.AreEqual(1f, model.AverageBuildHours);
            Assert.AreEqual(12f, model.AveragePullRequestHours);
            Assert.AreEqual(13f, model.LeadTimeForChangesMetric);
            Assert.AreEqual("Elite", model.LeadTimeForChangesMetricDescription);
            Assert.AreEqual(numberOfDays, model.NumberOfDays);
            Assert.IsTrue(model.MaxNumberOfItems > 0);
            Assert.IsTrue(model.TotalItems > 0);
        }