示例#1
0
        private void InitCommentsView(IFeedStorage storage, FeedNS.Feed feed)
        {
            IList <CommentInfo> comments = BuildCommentsList(storage.GetFeedComments(feed.Id));

            //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id));

            ConfigureComments(commentList, feed);
            commentList.Items      = comments;
            commentList.TotalCount = GetCommentsCount(comments);
        }
示例#2
0
        private void InitCommentsView(IFeedStorage storage, Feed feed)
        {
            IList <CommentInfo> comments = new List <CommentInfo>();

            comments = BuildCommentsList(feed, storage.GetFeedComments(feed.Id));

            //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id));

            ConfigureComments(commentList, feed);
            commentList.Items = comments;
            commentList.CommentsCountTitle = GetCommentsCount(comments).ToString(CultureInfo.CurrentCulture);
            commentList.TotalCount         = GetCommentsCount(comments);
        }
        public void FeedTest()
        {
            var feed1 = new Feed();

            feed1.FeedType = FeedType.News;
            feed1.Caption  = "aaa";
            feed1.Text     = "bbb";
            var feed1Id = feedStorage.SaveFeed(feed1, TODO, TODO).Id;

            feedStorage.SaveFeed(feed1, TODO, TODO);

            var feed2 = new Feed();

            feed2.FeedType = FeedType.Order;
            feed2.Caption  = "ccca";
            feed2.Text     = "ddd";
            var feed2Id = feedStorage.SaveFeed(feed2, TODO, TODO).Id;

            var feeds = feedStorage.GetFeeds(FeedType.News, Guid.Empty, 0, 0);

            CollectionAssert.AreEquivalent(new[] { feed1 }, feeds);
            feeds = feedStorage.GetFeeds(FeedType.Order, Guid.Empty, 0, 0);
            CollectionAssert.AreEquivalent(new[] { feed2 }, feeds);
            feeds = feedStorage.GetFeeds(FeedType.Advert, Guid.Empty, 0, 0);
            CollectionAssert.IsEmpty(feeds);

            feeds = feedStorage.GetFeeds(FeedType.All, Guid.NewGuid(), 0, 0);
            CollectionAssert.IsEmpty(feeds);

            feeds = feedStorage.SearchFeeds("c", FeedType.All, Guid.Empty, 0, 0);
            CollectionAssert.AreEquivalent(new[] { feed2 }, feeds);
            feeds = feedStorage.SearchFeeds("a");
            CollectionAssert.AreEquivalent(new[] { feed1, feed2 }, feeds);

            var feedTypes = feedStorage.GetUsedFeedTypes();

            CollectionAssert.AreEquivalent(new[] { FeedType.News, FeedType.Order }, feedTypes);

            feed2 = feedStorage.GetFeed(feed2Id);
            Assert.IsAssignableFrom(typeof(FeedNews), feed2);
            Assert.AreEqual(FeedType.Order, feed2.FeedType);
            Assert.AreEqual("ccca", feed2.Caption);
            Assert.AreEqual("ddd", feed2.Text);

            var c1 = new FeedComment(feed1Id)
            {
                Comment = "c1", Inactive = true
            };
            var c2 = new FeedComment(feed1Id)
            {
                Comment = "c2"
            };
            var c3 = new FeedComment(feed2Id)
            {
                Comment = "c3"
            };
            var c1Id = feedStorage.SaveFeedComment(c1).Id;
            var c2Id = feedStorage.SaveFeedComment(c2).Id;

            feedStorage.SaveFeedComment(c3);
            feedStorage.SaveFeedComment(c3);

            var comments = feedStorage.GetFeedComments(feed2Id);

            CollectionAssert.AreEquivalent(new[] { c3 }, comments);

            comments = feedStorage.GetFeedComments(feed1Id);
            CollectionAssert.AreEquivalent(new[] { c1, c2 }, comments);

            feedStorage.RemoveFeedComment(c2Id);
            comments = feedStorage.GetFeedComments(feed1Id);
            CollectionAssert.AreEquivalent(new[] { c1 }, comments);

            c1 = feedStorage.GetFeedComment(c1Id);
            Assert.AreEqual("c1", c1.Comment);
            Assert.IsTrue(c1.Inactive);

            feedStorage.ReadFeed(feed2Id, SecurityContext.CurrentAccount.ID.ToString());

            feedStorage.RemoveFeed(feed2Id);
            feedStorage.RemoveFeed(feed1Id);
            feed1 = feedStorage.GetFeed(feed1Id);
            Assert.IsNull(feed1);
            comments = feedStorage.GetFeedComments(feed1Id);
            CollectionAssert.IsEmpty(comments);
        }
示例#4
0
        private void InitCommentsView(IFeedStorage storage, Feed feed)
        {
            IList<CommentInfo> comments = new List<CommentInfo>();

            comments = BuildCommentsList(feed, storage.GetFeedComments(feed.Id));

            //AppendChildsComments(ref comments, storage.GetFeedComments(feed.Id));

            ConfigureComments(commentList, feed);
            commentList.Items = comments;
            commentList.CommentsCountTitle = GetCommentsCount(comments).ToString(CultureInfo.CurrentCulture);
            commentList.TotalCount = GetCommentsCount(comments);
        }