Ejemplo n.º 1
0
        public void TestNewIssuesOverExistingIssues()
        {
            // initialize parameter needed
            var newProjects   = new List <ProjectInfo>();
            var currentIssues = new Dictionary <int, IssueInfo>();
            var changedIssue  = new IssueInfo()
            {
                Id = 0, ProjectId = 42
            };

            currentIssues.Add(0, changedIssue);

            // get external data source
            ExternalDataSourceFactory.UseTestManager = true;
            var source = ExternalDataSourceFactory.GetRedmineMangerInstance("", "", 50);
            var issuesChangedProject = DownloadHelper.DownloadIssues(newProjects, currentIssues, source);

            // assert
            Assert.That(issuesChangedProject.Count, Is.GreaterThanOrEqualTo(1));
            Assert.That(changedIssue.Id.HasValue, Is.True);
            var issueId = changedIssue.Id.Value;

            Assert.That(issuesChangedProject.Keys, Contains.Item(issueId));
            var issue = issuesChangedProject[issueId];

            Assert.That(issue.ProjectId, Is.EqualTo(0));
        }
Ejemplo n.º 2
0
        public void GetDefaultInstance()
        {
            // arrange
            ExternalDataSourceFactory.UseTestManager = false;

            // act
            var instance = ExternalDataSourceFactory.GetRedmineMangerInstance(Url, ApiKey, 100);

            // assert
            Assert.That(instance, Is.Not.Null);
            Assert.That(instance.GetType(), Is.EqualTo(typeof(RedmineManagerInstance)));
        }
Ejemplo n.º 3
0
        public void TestIssueDownloader()
        {
            // initialize parameter needed
            var newProjects   = new List <ProjectInfo>();
            var currentIssues = new Dictionary <int, IssueInfo>();

            // get external data source
            ExternalDataSourceFactory.UseTestManager = true;
            var source = ExternalDataSourceFactory.GetRedmineMangerInstance("", "", 50);

            // download issues
            var issues = DownloadHelper.DownloadIssues(newProjects, currentIssues, source);

            // assert
            Assert.That(issues.Count, Is.GreaterThan(0));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method to get a redmine manager instance
        /// </summary>
        /// <param name="address">the host address</param>
        /// <param name="apiKey">the api key</param>
        /// <param name="limitForNumber">the limit to use for the number of issues</param>
        /// <returns>the redmine manager</returns>
        public static IExternalSource GetRedmineMangerInstance(string address, string apiKey, int limitForNumber)
        {
            var factory = new ExternalDataSourceFactory(address, apiKey, limitForNumber);

            return(manager);
        }