Пример #1
0
        public void Should_Compare_News()
        {
            var firstNews = redmineManager.GetPaginatedObjects <News>(new NameValueCollection()
            {
                { RedmineKeys.LIMIT, "1" }, { RedmineKeys.OFFSET, "0" }
            });
            var secondNews = redmineManager.GetPaginatedObjects <News>(new NameValueCollection()
            {
                { RedmineKeys.LIMIT, "1" }, { RedmineKeys.OFFSET, "0" }
            });

            Assert.IsNotNull(firstNews, "Get first news returned null.");
            Assert.IsNotNull(firstNews.Objects, "Get first news returned null objects list.");
            Assert.IsTrue(firstNews.Objects.Count == 1, "First news objects list count != 1");

            Assert.IsNotNull(secondNews, "Get second news returned null.");
            Assert.IsNotNull(secondNews.Objects, "Get second news returned null objects list.");
            Assert.IsTrue(secondNews.Objects.Count == 1, "Second news objects list count != 1");

            Assert.IsTrue(firstNews.Objects[0].Equals(secondNews.Objects[0]), "Compared news are not equal.");
        }
Пример #2
0
        public void Should_Get_Paginated_Issues()
        {
            var issues = redmineManager.GetPaginatedObjects <Issue>(new NameValueCollection {
                { RedmineKeys.OFFSET, OFFSET.ToString() }, { RedmineKeys.LIMIT, NUMBER_OF_PAGINATED_ISSUES.ToString() }, { "sort", "id:desc" }
            });

            Assert.IsNotNull(issues.Objects, "Issues is null.");
            CollectionAssert.AllItemsAreInstancesOfType(issues.Objects, typeof(Issue), "Not all items are of type issue.");
            CollectionAssert.AllItemsAreNotNull(issues.Objects, "Issues list contains null items.");
            CollectionAssert.AllItemsAreUnique(issues.Objects, "Issues are not unique.");
            Assert.IsTrue(issues.Objects.Count <= NUMBER_OF_PAGINATED_ISSUES, "number of issues <= " + NUMBER_OF_PAGINATED_ISSUES.ToString());
        }
Пример #3
0
        public void Should_Get_X_Users_From_Offset_Y()
        {
            var result = redmineManager.GetPaginatedObjects <User>(new NameValueCollection()
            {
                { RedmineKeys.INCLUDE, RedmineKeys.GROUPS + "," + RedmineKeys.MEMBERSHIPS },
                { RedmineKeys.LIMIT, LIMIT },
                { RedmineKeys.OFFSET, OFFSET }
            });

            Assert.IsNotNull(result, "Users list is null.");
            CollectionAssert.AllItemsAreNotNull(result.Objects, "List contains null user!");
            CollectionAssert.AllItemsAreUnique(result.Objects, "Users not unique!");
        }
Пример #4
0
 /// <summary>
 /// Gets the paginated objects asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <PagedResults <T> > GetPaginatedObjectsAsync <T>(this RedmineManager redmineManager, NameValueCollection parameters) where T : class, new()
 {
     return(Task.Factory.StartNew(() => redmineManager.GetPaginatedObjects <T>(parameters), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default));
 }
 /// <summary>
 /// Gets the paginated objects asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <PagedResults <T> > GetPaginatedObjectsAsync <T>(this RedmineManager redmineManager,
                                                                     NameValueCollection parameters) where T : class, new()
 {
     return(delegate { return redmineManager.GetPaginatedObjects <T>(parameters); });
 }
Пример #6
0
 /// <summary>
 /// Gets the paginated objects asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static Task <PaginatedObjects <T> > GetPaginatedObjectsAsync <T>(this RedmineManager redmineManager, NameValueCollection parameters) where T : class, new()
 {
     return(Task.Factory.StartNew(() => redmineManager.GetPaginatedObjects <T>(parameters), TaskCreationOptions.LongRunning));
 }