示例#1
0
        public WallContentViewModel(IEventAggregator eventAggregator, PullersController pullersController)
        {
            _eventAggregator   = eventAggregator;
            _pullersController = pullersController;
            CurrentPostFilter  = new CompositePostFilter();
            UnfilteredItems    = new List <PostViewModelBase>();
            FilteredItems      = new RangeObservableCollection <PostViewModelBase>();

            FilterPostsIsChecked   = true;
            FilterRepostsIsChecked = true;

            _eventAggregator.GetEvent <ContentEvents.LeftBlockExpandAllRequest>().Subscribe(expandAllItems);
            _eventAggregator.GetEvent <ContentEvents.LeftBlockCollapseAllRequest>().Subscribe(collapseAllItems);

            IsActiveChanged += onIsActiveChanged;
        }
        public void Composite_post_filter_test()
        {
            var compositePostFilter = new CompositePostFilter(PostType.Repost | PostType.Missing);

            var postList = new List <IPostType> {
                new FakePost(PostType.Missing),
                new FakePost(PostType.Missing),
                new FakePost(PostType.Post),
                new FakePost(PostType.Post),
                new FakePost(PostType.Post),
                new FakePost(PostType.Missing),
                new FakePost(PostType.Repost),
                new FakePost(PostType.Missing),
                new FakePost(PostType.Post)
            };

            var filteredList = postList.Where(compositePostFilter.Suitable).ToList();

            Assert.That(filteredList.Count(), Is.EqualTo(5));
            Assert.That(filteredList.Any(p => p.PostType == PostType.Post), Is.False);
            Assert.That(filteredList.Count(p => p.PostType == PostType.Missing), Is.EqualTo(4));
            Assert.That(filteredList.Count(p => p.PostType == PostType.Repost), Is.EqualTo(1));
            //compositePostFilter.FilterPosts();
        }