Esempio n. 1
0
        public async Task Should_Get_Attachment_By_Id()
        {
            var attachment = await redmineManager.GetObjectAsync <Attachment>(attachmentId, null);

            Assert.IsNotNull(attachment, "Get attachment by id returned null.");
            Assert.IsInstanceOfType(attachment, typeof(Attachment));
        }
Esempio n. 2
0
        public async Task Should_Add_Watcher_To_Issue()
        {
            await redmineManager.AddWatcherAsync(watcherIssueId, watcherUserId);

            Issue issue = await redmineManager.GetObjectAsync <Issue>(watcherIssueId.ToString(), new NameValueCollection { { "include", "watchers" } });

            Assert.IsNotNull(issue, "Get issue returned null.");
            Assert.IsTrue(issue.Watchers.Count == 1, "Number of watchers != 1");
            CollectionAssert.AllItemsAreNotNull(issue.Watchers.ToList(), "Watchers contains null items.");
            CollectionAssert.AllItemsAreUnique(issue.Watchers.ToList(), "Watcher items are not unique.");
            Assert.IsTrue(((List <Watcher>)issue.Watchers).Find(w => w.Id == watcherUserId) != null, "Watcher not added to issue.");
        }
Esempio n. 3
0
        public async Task <IEnumerable <CommonRemineEntities.Tracker> > GetTrackersAsync(int projectId)
        {
            var filter = new NameValueCollection
            {
                { RedmineKeys.INCLUDE, RedmineKeys.TRACKERS }
            };

            return((await RedmineManager.GetObjectAsync <Project>(projectId.ToString(), filter)).Trackers
                   .Select(t => EntityMapper.Map <CommonRemineEntities.Tracker>(t))
                   .ToArray());
        }
Esempio n. 4
0
        public async Task <CommonRemineEntities.Issue> GetIssueAsync(int id)
        {
            var parameters = new NameValueCollection();

            parameters.Add(RedmineKeys.INCLUDE, RedmineKeys.JOURNALS);

            // TODO support multiple values
            var redmineIssue = await RedmineManager.GetObjectAsync <Issue>(id.ToString(), parameters);

            var issue = EntityMapper.Map <CommonRemineEntities.Issue>(redmineIssue);

            return(issue);
        }
Esempio n. 5
0
        //  [ExpectedException(typeof(RedmineException))]
        public async Task Should_Get_User_By_Id()
        {
            var user = await redmineManager.GetObjectAsync <User>(userId, null);

            Assert.IsNotNull(user, "Get user by id returned null!");
        }